Monday, June 6, 2011

Unity: Inter-Level Portals

Okay, that was far less painful than I expected. To fix the problem of multiple instances of singletons, I simply had each object check that no instance existed in it's Awake() method, and then destroy itself if necessary. This is much easier than trying to write a manager object clever enough to only instantiate the right things at the right time, and it means I can throw a player/camera/etc. into any scene I'm currently working on without fear of destroying the universe.

So: Inter-Level Portals.

Not much to say, really. They're working! If you play the test case, cross the platforms, and make contact with the 'door' at the far top-left of the level, you'll be teleported to another level. There's nothing in this demo that makes it clear it's another level. Which is a good thing, I guess. But it does make this demo kind of pointless:


Or not entirely, as a new task has been identified:
  • Flag objects to spawn only once to prevent respawning on level load.
That can wait though, as I'm really keen to get some kind of player health system working. What I'm imagining for my platformer will only involve a handful of once-only collectables anyway, which I could always just flag in a global variables container of some sort.

And working on the health system will mean I can spend time drawing pixel hearts. I'm totally going to get a pixel heart tattoo. People will think I'm all gangster and shit.

No comments:

Post a Comment