Two way doors in a platformer
I'm back with another question. The game I'm working on is a platformer with heavy inspiration from games like kirby, Cave Story, etc.. I'm using doors to let the player traverse between frames.
I've figured out how to get them to work. I have it set so when the player is overlapping the door, and the player presses up up arrow, he is transferred to the next frame.
This works for the most part, but I don't know how to get the player to appear in the right area when he moves frames. He obviously starts wherever I place his object on the frame when I make it. For example, when I go back from frame two to frame one, he appears back at the left side of the map, where he originally started.
I need to know some way to make using the door send his object over to where I want it on the next frame, so I can have him go back and forth through doors without it being awkward like that.
Re: Two way doors in a platformer
*User presses up
*Overlapping door 1
-set alterable value A to 1
-go to level 1
*Start of frame
*alterable value A of Player=1
-set position of player in front of door 1
You'll need your player to be global, but I'm assuming it already is.
Re: Two way doors in a platformer
When a door is used, set Global Value A to the X position you want the player to appear on the next frame, and same with Global Value B and the Y position. At the start of any frame, set the player's position to (Global Value A, Global Value B).
Note: You will have to specify the two global values before starting the game, so the player will appear in the right place the first time.
Re: Two way doors in a platformer
Alright, I haven't fooled around with Global variables yet. I'll work around with that and try to figure it out from there.
Thanks for the help.
Edit:
Alright, for the most part it works. I just have a little addendum to the original question. Is there some way I can change his direction with variables as well, so I can make him facing a certain way when I go back through the door, instead of always starting out by facing right?
Re: Two way doors in a platformer
You can set direction based on an expression, there is a button to do this in the direction selector.
Re: Two way doors in a platformer
save the direction (that is, Dir("Hero")) to global value C, and then set his direction at the beginning of the level to Global Value C.
Just as a future reference note, MMF saves all its directions on a 32 direction basis, so left is "16" and right is "0" regardless of how many animation frames you have.