The Daily Click ::. Forums ::. Klik Coding Help ::. Things happening insant( or something P )
 

Post Reply  Post Oekaki 
 

Posted By Message

PotatoCannon



Registered
  20/07/2008
Points
  463

VIP MemberI am an April FoolThe Spinster
22nd January, 2013 at 22/01/2013 09:38:50 -

so, i'm not that good at mmf2 but im learning how to make my own platform custom movement right now. I am now trying to make him doubble jump and here is my problem:

The code looks like this:

( alterable "jump count", counts how many times you have pressed the jump button )


<when ''player'' are overlapping a ''platform''
> set "jump count" to = 0

<When ''Player'' are overlapping a ''platform''
<And press Ctrl
> Set "jump count" to = 1
> set "grav" to -10

<When "jump count" is equal to 1
<and press ctrl
> set "grav" to -6
> set "jump count" to = 2

Now when i run this and press ctrl, it jumps directly to the last event. What can i do to fix this?, should i build the code in a different way?


 
n/a

PotatoCannon



Registered
  20/07/2008
Points
  463

VIP MemberI am an April FoolThe Spinster
22nd January, 2013 at 22/01/2013 12:36:51 -

Ok, i fixed it, i used flags instead, but shouldn't this be able to work?

 
n/a

PotatoCannon



Registered
  20/07/2008
Points
  463

VIP MemberI am an April FoolThe Spinster
22nd January, 2013 at 22/01/2013 12:36:56 -

Ok, i fixed it, i used flags instead, but shouldn't this be able to work?

 
n/a

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
22nd January, 2013 at 22/01/2013 13:40:31 -

You ought to take a look at previously-made engines that address double-jumping. I personally use DavidN's engine, freely available on the clickteam.com tutorials page, for my own projects. But if you do a search for platform engines here on TDC you will find some impressive pieces of work to build your own projects. You won't be reinventing the wheel (or dealing with frustrations) on this one.

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
22nd January, 2013 at 22/01/2013 14:10:49 -

Think carefully about the order of events, and what is actually happening at each stage.

Your problem is that by the time MMF2 gets to line #3, "jump count" has already been set to 1 in the previous line, so both events are triggered during the same frame.
If you swap lines #2 and #3, your problem will be fixed, because the event that sets "jump count" to 1, then comes after the event that checks if it is 1.

ie.

<when "player" are overlapping a "platform"
> set "jump count" to = 0

<When "jump count" is equal to 1
<and press ctrl
> set "grav" to -6
> set "jump count" to = 2

<When "Player" are overlapping a "platform"
<And press Ctrl
> Set "jump count" to = 1
> set "grav" to -10

 
n/a

PotatoCannon



Registered
  20/07/2008
Points
  463

VIP MemberI am an April FoolThe Spinster
22nd January, 2013 at 22/01/2013 19:06:05 -

ahh thanks

 
n/a
   

Post Reply



 



Advertisement

Worth A Click