I am working on a platform game with many different room each on their own frame. I am try to think of a way to transition between frames while keeping the relative position of the player. Games like Castlevania SOTN and Super Metroid do this. Below is a reference to help explain my situation.
The top picture represents the current way I have it. The Player exits one frame and in the next frame the layer starts wherever I placed the player object.
The bottom picture represent the player jumping through the frame and on the second frame he comes out the way he went in.
If it comes to the only solution being that it all HAS to be one frame then, how big can you make a frame without encountering problems?
Hello guys! I'm New! -- I've been new for a year now...haha
record your characters X & Y values as global values, and find the offset you need to add to this, and position your character to that at the start of the frame.
The offset would be the difference between where the player should be and where the player "spawns."
I would use an active object placed at the very bottom of the "loading zone," as a ground marker. When changing the frame, just get the Y distance between the player and the marker, then add that to the player's Y position at the start of the next frame. For this to work though, the player would have to be "spawned" at ground level. The only problem I'd be able to foresee with this method is that the player wouldn't be high enough or too high off the ground during the transition, in which case some simple math would have to be done (adding or subtracting the "height" of the player) to compensate.
Originally Posted by Logiq Okay I understand now. I'll try it and see what comes up.
With all the values/flags and such, what do you use to keep yourself organized? right now I'm using a notebook and a grid paper.
I use a notebook too. My game I'm making does the same type of thing you're trying to do with room transitions and what I did is have 2 global values for the player's starting X and Y position in any given room. I then place little active picture objects just outside the frame where the doors would be. When the player collides with one of these active pictures, I set his X and Y value to where he's going to start on the next room you're traveling too. To keep it neat, under global events I have:
Start of Frame ->
Set "player X position" to globalX
set "player Y position" to globalY
Now doing it this way will work, but for some things you may not want a static variable for entering a new room (like if you've just jumped upwards into a hole and you want to go either left or right in the room above it). In that case you just make it so the globalX is equal to the player's current X value, so if you jump up to the left side he'll still be on the left side and if you jump up and to the right he appears in the next room on the right side.
Hopefully this helps.
Edited by the Author.
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
So have the positioning correct now. And I even have the current velocity of the play working between the frames. Now the problem I am having is that if I hold the directional button for the movement it will stop in between frames. The player will have to lift their finger off the button and re-hold it to resume movement. This is something that I can live with for now but I won't want it in my finished product. Does anyone have any suggestions?
Hello guys! I'm New! -- I've been new for a year now...haha
Originally Posted by UrbanMonk Use an extension, like the control x extension, it should work between frames
I'm not sure this achieves what he's looking for...
The best way to do this, is to have a collision object for the door which sets two global values for the transition and then two others that hold the offsets from it so when you hit it you would say:
+ on collision with "Door"
= set DoorX to 100
= set DoorY to 100
= set DoorXOff to X("Player")-X("Door")
= set DoorYOff to Y("Player")-Y("Door")
= set ThroughDoor to 1
= jump to frame 2983667297
Then on the next frame:
+ start of frame
+ ThroughDoor = 1
= set X of "Player" to DoorX+DoorXOffset
= set Y of "Player" to DoorY+DoorYOffset
= set ThroughDoor to 0
to Ben. Thats the exact same system I've got in Tormi. But with added inertia and direction from the previous frame.
Best still set it as a qualifier but remove the 'jump to frame bit'. So that way you can have as many doors as you like in that frame. Then have seperate jump to events, or make all the objects individual with a set Value which has the frame number to jump to.
Originally Posted by Dr. James to Ben. Thats the exact same system I've got in Tormi. But with added inertia and direction from the previous frame.
Best still set it as a qualifier but remove the 'jump to frame bit'. So that way you can have as many doors as you like in that frame. Then have seperate jump to events, or make all the objects individual with a set Value which has the frame number to jump to.
Yeah in my game I actually have it in a qualifier with all that data in alterable values so there's only one event for all doors, thought I'd keep it simple here .