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

Post Reply  Post Oekaki 
 

Posted By Message

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
26th July, 2007 at 15:58:19 -

Well, MMF2 has been sat on my shelf doing nothing for a good few months now. Today I decided that it was time I left TGF alone and kicked it up a knotch with MMF2.

I also decided to start doing custom movements, too... Got my left/right movement and very basic gravity done but I'm very stumpped at jumping. I can't really seem to think of a way around it. Maybe with a counter/value/etc? Whats the easiest way? Oh, I do have another problem: getting the falling animation to play properly.

Bottom detector not overlapping BG -> Player Y Pos -2 + change animation to "falling"

With that the animation will not play. It changes but sticks at frame 1. Is this because its constantly setting the animation to "falling"? If so, how could I correct this? Thanks for any help

 
Image

Tell 'em Babs is 'ere...

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
26th July, 2007 at 18:01:16 -

the way i do it is make the objects y value relate to a value (a counter or an alterable value that i call 'jump')
(make characters y value related to it's y value + 'jump')

then have three modes (also an alterable value)

stop = 0
rise = 1
fall = 2

so 0 makes the 'jump' value 0
1 makes the jump value subtract
2 makes the jump value add

then it's a matter of pressing a button to make the value 1 until you've jumped enough (jump = -25 set jump mode to 2)

then hitting the floor will make jump mode 2.

well thats how i used to do it, it's not really very good because you'll sink into the floor.


 
.

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
26th July, 2007 at 21:48:05 -

I have an alt variable called JUMP CEILING that when the player presses the jump button , JUMP CEILING is set to the player's Y position - 40 and a flag is set to on. Then, while that flag is on you have an event that subtracts -2 to the player's Y position. When the player's Y position <= JUMP CEILING, then you turn the flag off and he'll fall.

It's way more complicated to get it to not look like crap though, which is something I'm working on at the moment myself

 
--

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

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
26th July, 2007 at 21:51:11 -

Oh... dear.

You should keep watch for better jumping methods.

 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath

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
26th July, 2007 at 22:33:45 -

Yeah I know. I've been trying to work Phizzy's awesome examples into my own but mine is too over-complicated and integrated to be changed too much and have it work. Worst of all is the friggin' hype over this thing is getting ridiculous, in a bad way if I can't cut the mustard!!

 
--

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

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
27th July, 2007 at 02:04:56 -

You guys are crazy! ;O

I just have events that say something like this:

* Player isnt on the ground: increase his y speed by some constant rate (that would be the force of gravity) (If he is on the ground, set his y speed to 0!)

* Always set position y = current position + y speed (Not this basic, of course, you probably want to use the fastloop method that moves an object 1 pixel at a time and such, or whatever applies to your specific engine!)

* player pushes jump key, set the y speed to some negative number. Maybe -7 for an example, this will launch the player up in the air.

* with the gravity always acting, everything will take care of itself! The player rises into the air, and falls back down with a perfect parabola if you did it right. ;D

I hope that was clear. I'm very tired and I didnt go into any detail :I


 
n/a

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
27th July, 2007 at 03:17:54 -

Do it like xerus said, there is no need for extra alt values.

 
n/a

The Chris Street

Administrator
Unspeakably Lazy Admin

Registered
  14/05/2002
Points
  48488

Game of the Week WinnerClickzine StaffAcoders MemberKlikCast StarVIP MemberPicture Me This Round 35 Winner!Second GOTW AwardYou've Been Circy'd!Picture Me This Round 38 Winner!GOTM December Third Place!!
I am an April FoolKliktober Special Award Tag
27th July, 2007 at 08:31:48 -

I do it Xerus' way, but with a slight modification:

Set Position of Player to Y(Player)+ Alterable Value A (Player)/3

If you make the engine without the "/3" part the player will fall down very quickly. Of course, you can change the 3 to a 4, or even a 5... it depends on what sort of game your engine will represent.

Image Edited by an Administrator.

 
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
27th July, 2007 at 08:44:44 -

You mean have the /3 or /4 part.. Act sort of like increasing a player's Y position when falling by .5 or so?

 
--

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

The Chris Street

Administrator
Unspeakably Lazy Admin

Registered
  14/05/2002
Points
  48488

Game of the Week WinnerClickzine StaffAcoders MemberKlikCast StarVIP MemberPicture Me This Round 35 Winner!Second GOTW AwardYou've Been Circy'd!Picture Me This Round 38 Winner!GOTM December Third Place!!
I am an April FoolKliktober Special Award Tag
27th July, 2007 at 08:52:32 -

Kind of, yeah, so in effect the gravity effect is slowed down.

 
n/a

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
27th July, 2007 at 09:54:08 -

Thanks for all the help, guys

I seem to be having a problem with the fast loop though. I tell it to move the player up 1 pixel and to loop 60 times. So its just positioning the player up there right away, not pixel by pixel... How do I get this part a workin'? (I'm horribly new to this, ugh)

Image Edited by the Author.

 
Image

Tell 'em Babs is 'ere...

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
27th July, 2007 at 11:02:49 -

You could make the "on loop" event have this condition:

On loop "jumping"
+ top detector overlaps the background <NEGATED>

= sub 1 to player's Y position



This should keep him from going through the ceiling at least.

 
--

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

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
27th July, 2007 at 11:31:09 -

Hmm... that event seems to disable jumping. :S

Edit: Oops, my bad. Still went through the ceiling though Its like its just ignoring the fast loop and just positioning the active object there right away. I'm really confuzzled. :S

Image Edited by the Author.

 
Image

Tell 'em Babs is 'ere...

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
27th July, 2007 at 16:45:22 -

Uh slink, the point of fastloops is that it does everything in one (TGF/MMF) loop

Your character did indeed move up one pixel at a time, it's just that all those 60 loops ran so fast you couldn't see it. You need a "stop loop" event in there.

 
Craps, I'm an old man!

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
27th July, 2007 at 19:35:00 -

A stop loop, eh? Hmm... Where abouts? :S

I've set it up like this:

Image

 
Image

Tell 'em Babs is 'ere...

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