The Daily Click ::. Forums ::. Klik Coding Help ::. Linking Position Between Frames
 

Post Reply  Post Oekaki 
 

Posted By Message

Logiq



Registered
  09/04/2007
Points
  120
30th September, 2008 at 18:05:12 -

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.

Image

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

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
30th September, 2008 at 18:12:19 -

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.

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

Logiq



Registered
  09/04/2007
Points
  120
30th September, 2008 at 18:17:10 -

explain "find the offset" please.

 
Hello guys! I'm New! -- I've been new for a year now...haha

aphant



Registered
  18/05/2008
Points
  1242
30th September, 2008 at 18:45:14 -

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.

 

Logiq



Registered
  09/04/2007
Points
  120
30th September, 2008 at 18:49:37 -

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.

 
Hello guys! I'm New! -- I've been new for a year now...haha

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
30th September, 2008 at 19:32:02 -


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.


Image 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!

Logiq



Registered
  09/04/2007
Points
  120
30th September, 2008 at 22:24:12 -

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

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
1st October, 2008 at 00:00:03 -

Use an extension, like the control x extension, it should work between frames

 
n/a

Logiq



Registered
  09/04/2007
Points
  120
1st October, 2008 at 05:44:18 -


Originally Posted by UrbanMonk
Use an extension, like the control x extension, it should work between frames



I am using the control X object....still no go.

 
Hello guys! I'm New! -- I've been new for a year now...haha

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
1st October, 2008 at 07:08:20 -


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

That should be the general idea .



 
Image
http://bfollington.tumblr.com

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
1st October, 2008 at 07:45:28 -

use a single frame and use this scrolling effect.

http://www.create-games.com/forum_post.asp?id=228341

 
n/a

Dr. James MD

Addict

Registered
  08/12/2003
Points
  11941

First GOTW AwardSecond GOTW AwardThird GOTW AwardPicture Me This -Round 26- Winner!
1st October, 2008 at 11:05:16 -

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.

 
Image
http://uk.youtube.com/watch?v=j--8iXVv2_U
On the sixth day God created Manchester
"You gotta get that sand out your vaj!" x13
www.bossbaddie.com

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
1st October, 2008 at 12:10:58 -


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 .

 
Image
http://bfollington.tumblr.com

Logiq



Registered
  09/04/2007
Points
  120
2nd October, 2008 at 14:57:46 -

So why do you set DoorX and DoorY to 100? I understand the rest of it but I just don't know specifically the 100.

 
Hello guys! I'm New! -- I've been new for a year now...haha

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
3rd October, 2008 at 14:32:03 -


Originally Posted by Logiq
So why do you set DoorX and DoorY to 100? I understand the rest of it but I just don't know specifically the 100.



The 100 was an example number, you use the target coordinates.

 
Image
http://bfollington.tumblr.com

Logiq



Registered
  09/04/2007
Points
  120
3rd October, 2008 at 20:04:43 -

ok cool. just making sure...by the way, i got it to work. thanks.

 
Hello guys! I'm New! -- I've been new for a year now...haha
   

Post Reply



 



Advertisement

Worth A Click