The Daily Click ::. Forums ::. Klik Coding Help ::. (exploring game-like) frame jumping problem
 

Post Reply  Post Oekaki 
 

Posted By Message

ugo



Registered
  07/11/2008
Points
  3
2nd November, 2009 at 15:13:30 -

Hello everyone, Ugoz from Italy here. I think that my problem is a very noobish one but searching the forums/articles didn't help me, so I hope you can. I'm making a sort of exploring platformer, and the "world" is split in various frames (e.g.: Knytt Stories). I'm stuck with the frame jumping system. How can I make the character's position be stored when jumping from frame to frame? For example: You start on the left side of frame-1; when you reach the right side you jump to the left side of frame-2; then you want to go back and this time (if things are done correctly) you jump to the RIGHT side of frame-1.
I've tried to use INIs but I messed up. Then I found a thread ( http://www.create-games.com/forum_post.asp?id=183787 ) which explained a global value method, but it's a "one-way" type of jumping, you can't use it with multiple frames (or at least this is what I figured by trying it). Some suggest the use of arrays but I don't know how to use them (not with some kind of step-by-step tutorial about frame jumping).
Can you help me?

 
n/a

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
2nd November, 2009 at 16:03:29 -

Hi Ugo!

If you want you can do the same thing I've done for Hasslevania (and also the sequel) and it works very well.

Just have your main hero have 2 alt values that keep track of his position called PlayerX and PlayerY. Then for your project have 2 global values called StartX and StartY.

When you player leaves one frame, before jumping to the next frame change the global values of StartX and StartY to wherever you want the guy to start off in the next frame.

Lastly, and this is important, make a single line global event that says:

Start of Frame -> Set PlayerX to StartX -> Set PlayerY to StartY

--

Do it this way and your guy will always start off on the next frame wherever you want him. If you don't want him in a set place Y-wise (like if the guy jumped off the frame) then you'd do something like StartY = PlayerY -> jump to the next frame.

I hope I explained it right, but trust me this method dodes work.

 
--

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

Rob Westbrook



Registered
  25/05/2007
Points
  193

360 OwnerVIP Member
2nd November, 2009 at 16:18:17 -

From what you describe it sounds like it would just be easier to have one massive level, and jump the scrolling as you go off the sides of each visible area. That's how Knytt does it and it's fairly easy to implement:

+Player is getting closer than 0 pixels from window's edge
-Center display at X: (X("Player")*Visible Area Width/Visible Area Width)+Half Visible Area Width
-Center display at Y: (Y("Player")*Visible Area Height/Visible Area Height)+Half Visible Area Height

Hope that helps!

 
There are 10 types of people in the world: Those who understand binary and those who don't.

ugo



Registered
  07/11/2008
Points
  3
4th November, 2009 at 18:11:58 -

Thank you very much guys you really helped me out Now i just have to decide which method suits me best!

 
n/a
   

Post Reply



 



Advertisement

Worth A Click