Hi all I've just prototyped a 'door' mechanic which is trying to emulate the way traditional 2D games like Cave Story work.
Here's the Capx https://dl.dropboxusercontent.com/u/3317708/Doors.capx
My objective is to have the player spawn in the new layout from the door they just used.
If you see in my Capx my method uses quite a lot of events, I'm wondering if anyone can think of a more efficient / streamlined approach to creating this system? I can imagine that as my project gets bigger, it's going to be a hell of pain to keep track of all these doors in the way I'm currently doing it. Any info on this would be appreciated.
Try something like this:
Give door object instance variable: gotoLayout
For each door, put the name of the layout you want the door to lead into this variable.
On spacebar pressed
Player is overlapping door
.. goto layout door.gotoLayout
.. // perhaps set your 'locationPoint' here too, so you know where to spawn the player in the new layout
Ah that sounds good I'll try it out and report back!
Develop games in your browser. Powerful, performant & highly capable.
vee41 Hmmm I totally understand how to use the variables to tell the game what layout to go to but I'm struggling to figure out how to get the player to spawn in the correct location. I've updated the original capx with where I am at at the moment.
This should work:
What I changed is, that it saves the name of the layout when entering a door, and at the next layout, spawns the player at the door that leads to previous layout.
great that makes sense but I'm getting errors from dropbox downloading your file :(
CrudeMik Fixed it.
Perfect, thanks a bunch