The Daily Click ::. Forums ::. Klik Coding Help ::. Custom jumpin'
 

Post Reply  Post Oekaki 
 

Posted By Message

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
28th July, 2007 at 06:55:16 -

Well, what if you also made it so that in order to jump, Player Flag 1 has to also be set to ON. Then you can add another line like "if Player top detector overlaps the background (i.e. hits his head on the ceiling or whatever) set Player Flag 1 to OFF." You'd have to work gravity in there still, maybe use another flag? I'm new at this too but it may 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!

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
28th July, 2007 at 08:14:13 -

Fastloop jumping works something like:

Set up the way xerus said to use an alt value for Y movement .

Always ->
start loop "jump" Abs(AltValA("Player")) times

on loop "jump"
+ bottom detector is not overlapping a backdrop
+ AltValA("Player") > 0 ->
Set Y position to Y("Player)+1

on loop "jump"
+ top detector is not overlapping a backdrop
+ AltValA("Player") < 0 ->
Set Y position to Y("Player)-1

This does gravity too though. A fastloop run 30 times is as good as moving 30 pixels in a frame, so the always event keeps it at MMF drawable speed if you will .

As always someone is free to correct me but i think this should work, it did in an engine i made anyway...

Image Edited by the Author.

 
Image
http://bfollington.tumblr.com

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
28th July, 2007 at 09:17:28 -

Slink, the typical proceedure is to check for collisions every loop, then when there is one, back up the character 1 pixel (So it's not overlapping the wall) and do the stop loop.

 
Craps, I'm an old man!

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
28th July, 2007 at 19:50:07 -

Ben, that looks fine, but I think its confusing to call that loop "jump" I would name it something like "moveY" or something like that, since its taking care of all actions that could possibly move the player on the y axis.

The reasoning for the fast loops is pixel perfect collision. If you were to move your player at a ridiculous speed, say 60 pixels per frame, without fast loops, you're probably going to pass through backdrops and other actives since you'll skip right over them. But with a fast loop moving the player 1 pixel 60 times per frame, each pixel of movement checks for a collision, and you wont see the next frame until after that fast loop is done-- so you get the same thing, but with accurate collisions. Plus, you dont have to worry about pushing the player out of walls too much since the deepest they can go is 1 pixel.

I remember going through custom platform tutorials when I first was getting into MMF, and I was always so confused as to why people always named their player's y speed value "Gravity." That totally messed with me :I

 
n/a
   

Post Reply



 



Advertisement

Worth A Click