How do I Solve this Issue With a Condition

0 favourites
  • 6 posts
From the Asset Store
Solve the mathematical equations as fast as you can!
  • Hello there i'm working on a platformer with a Physics engine and i have recently implemented a custom "jump thru" function using these conditions in the image (1) , its works well aside from the fact that if the player docent press any other button and lands on a platform and trys to jump thru again it will not register , im assuming this is because of the on pressed condition only works once where as we need this to work multiple times , if any one can suggest a solution that would be great.

    (1) http://i.imgur.com/1kdddEk.png

    Thanks for your time ,Ryan.

  • Just a stupid question from my side. What's wrong about the built in Jump-Thru behavior? It works fine for me

    In your code example the Function will be called every time the Space key gets pressed. So this should be fine. I'm not quite sure about the 'wait' action in the function.

    I have something in mind that wait actions in a function can cause issues. But I'm not sure about that.

    I would recommend to use following code.

    GlobalVariable: IsOnJumpThru (Or boolean for the player, is up to you)

    //This is simular to your function.

    On Function "JumpThru" (alternative: Player is on Jumping && Trigger Once While True

    • Set IsOnJumpThru to 1
    • Disable Physic Collisions for Player A
    • Disable Physic Collisions for Player B

    //Once the jump is over (when the player was landed on the platform)

    If IsOnJumpThru = 1 && Player is ladding

    • Set IsOnJumpThru to 0
    • Enable Physic Collisions for Player A
    • Enable Physic Collisions for Player B

    Regards

    Andreas

  • Hey there thanks for your reply , To answer your question i am using physics rather than the platformer behavior with the players , the jump thru wont work with physics and needs to be done spereatly , i apologies for making that unclear.

    Also i will give you suggestion a try alto its not any issue with function or wait as those things seem to be fine rather its not recognizing multiple inputs , again thanks will update after have tried this.

    Thanks for your time ,Ryan .

  • The issue probably is the Wait, as there is no way to cancel a wait, so when you hit the key again, you set the disable but there is still that wait in the background, and it will kick in and cancel out your disable. Try using a timer, instead of wait. Then you can reset the timeout on the next key press if it comes in quickly, and you can push out the enable code.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just came across this old topic because I'm facing the same issue now. Is there a specific reason why jump thru doesn't work with physics Ashley ?

    I'm using the physic behavior for my player and the world. Some platforms have the jump thru and physic behavior, but then jump thru doesn't work like it should anymore.

    Thank you!

    Regards

    Andy

  • You can't mix most behviours with Physics. This has come up many times.

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