Character bounces once upon landing?

0 favourites
  • 9 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • I love it on Mario when he lands, and he does a little bounce just once as he collides with the ground. Is there a really easy way of doing this? I'm moving over from MMF, and usually you'd have to test flags or alt values for the character being airborne and flagging on and off so the bounce occurs once per fall. I'm using the default platform engine if this helps Thanks!

  • Create a global Variable called Bounce.

    Create 2 sets of conditions.

    1st)

    Player > On Landed >

    ........ (sub event) System > Bounce =1 > Set Bounce to 0

    .......... Else...........System > Bounce =0 > Set Bounce to 1

    2nd)(dual conditions)

    Player > On Landed > Set Platform Vector Y -600

    System > Bounce =1

  • Hi there, thanks for the help so far, I have tried this but the character keeps continually bouncing and doesn't stop :/ Did I put this in correctly?

  • Event 44 is unnecessarily complicating things. Remove it and set the object's Y vector in event 42 instead and you should be golden.

    On a side note, you should have an event that sets bounce back to 0 upon jump. If you don't do this, your bounce state can get messed up if the player jumps right as they're first hitting the ground.

  • Platform on landed

    ACTION ----> Set Bounce to 1 - Bounce

    -sub-event: Bounce = 1

    ACTION ----> Set Vector Y to -600

    ACTION ----> Set Bounce to 0

    -sub-event: Bounce = 0

    ACTION ----> Set Bounce to 1

  • Thank you all, this seems to work! Just out of interest, what is Set Bounce to 1 - Bounce doing? I'm having fun with the subevents, something MMF never entertained possibilities of (not to mention proper Else operators!!)

  • Here's a screen shot of how I employed it

  • Zebbi

    the 2 sub-events should be same level.

    like this:

    Platform on landed

    ACTION ----> Set Bounce to 1 - Bounce

    --------sub-event: Bounce = 1

    --------ACTION ----> Set Vector Y to -600

    --------ACTION ----> Set Bounce to 0

    --------sub-event: Bounce = 0 (same level as sub-event above)

    --------ACTION ----> Set Bounce to 1

    technically, the way you do it in your screenshot is working only because you have the "set Bounce to 0" action before the sub-event with condition "Bounce = 0". Codes are read top to bottom.

    Just read the conditions from top to bottom, first check if landed, then Bounce = 1, then if Bounce = 0 ? The last 2 conditions are not possible to be true at the same time. So yeah the 2 sub-events should be same level

    if Bounce = 1,

    Bounce = 1 - Bounce

    Bounce = 1 - 1

    Bounce = 0

    if Bounce = 0

    Bounce = 1 - Bounce

    Bounce = 1 - 0

    Bounce = 1

    Let's just say you chose to use values that aren't 0 and 1, then you can't use that 1-Bounce expression/formula

    Quickly edited your screenshot here to match what I was saying

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yes, a little cleaner but the result is identical.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)