Fall through Platforms/Crouch/Jump Sustain

This forum is currently in read-only mode.
From the Asset Store
A pack of 76 platform designs for a platformer game with a mushroom/jungle theme
  • The Platform Behavior has an option called "allow down button" which makes your player fall through platforms when he hits the down control.

    I want to allow my player to crouch while on platforms and fall through them if he jumps while holding down. I can uncheck "allow down button" and in the event sheet editor check for down AND jump and set the player to "fall through platforms", but the jump action happens before he starts falling and he winds up jumping.

    If I disable the jump as a control and just check for when the shift (jump) button is pressed, I can make the character jump while standing and fall through platforms while ducking.

    The problem with this is that when you make the player jump with event code, it ignores the "jump sustain" property.

    Is there a better way to allow crouching on platforms, falling though platforms with down and jump, and jump sustain?

    Thanks for any tips!

    --Edit--

    Wait a minute. What if I just set the player's jump strength to 0 while ducking? I think that just might work. I'll try it out.

  • What if I just set the player's jump strength to 0 while ducking? I think that just might work. I'll try it out.

    I'm not on my Construct computer right now, so I can't test it out, but if that doesn't work, you could try something like:

    (at the top of your control events)
    +Always
      ->playerSprite[Platform]: Don't ignore input
    
    +On control "Jump" pressed
    +Control "Move down" is down
    +playerSprite is overlapping Platform at offset (0,2)
      ->playerSprite[Platform]: Ignore input
      ->playerSprite[Platform]: Fall through platform
    [/code:239o6kfp]
    
    That way it will ignore the controls for a single tick so you won't jump, then reactivate the controls at the start of the next tick.  I did something similar for the fall-through platforms in Little Hitler in Toyland, but I can't remember the exact method.  I'll look it up as soon as I can get at Construct.
  • Thanks for the reply. i'm thinking now that I'll probably use some detectors to see if the player is on solid ground or a platform and adjust the code thusly (pretty much what you said)

    So (hint hint) keep those platformer tutorials coming, please!

  • I'm not on my Construct computer right now ...

    So in other words that's just off the top of your head. Right. The only thing I can get off the top of my head is dandruff. *sigh*

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The method I posted before doesn't seem to work the way I thought it would.

    This, on the other hand, works like a charm:

    <img src="http://i40.tinypic.com/2gy366s.png">

    And it's the simplest method I could come up with. Setting it to fall when Jump is pressed won't mess things up when you're jumping without holding down because it processes the jump before the fall, it seems.

    By the way, David... the Yes and No seem to be reversed in the "Fall through platforms" dropdown (which means that in event 3 you're actually telling Construct to fall, and in event 2 you're telling it not to)

  • Thank you that works beautifully!

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