How do I reset the jump counter for Platform behv.

  • Hi,

    I want to let the player bounce off after a collision. I did use following code.

    on collision player with enemy

    • > Player -> Simulate control jump

    This actually works fine, but however if the player hits the enemy for the third time (and the player haven't touched the ground since then), no jump will be performed.

    So is there a way to do following?

    on collision player with enemy

    • > Player -> Set Jump Counter to 0 (I know there is no action like this)
    • > Player -> Simulate control jump

    Or has anybody another idea to let the player bounce off from an emeny after collision?

    Thank you!

  • I wouldn't do a simulate jump. I would use 'Set Platform vector Y'.

    If you use the triggered 'on collision with ..' it should work, otherwise with non-triggered events the player would fly upwards.

    Something like: Player| On collision with Enemy -> Player| Set Platform vector Y to 'myJumpStrength'

    'myJumpStrength' has to be negative like -650.

  • I wouldn't do a simulate jump. I would use 'Set Platform vector Y'.

    If you use the triggered 'on collision with ..' it should work, otherwise with non-triggered events the player would fly upwards.

    Something like: Player| On collision with Enemy -> Player| Set Platform vector Y to 'myJumpStrength'

    'myJumpStrength' has to be negative like -650.

    That worked perfectly! Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is the result <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    https://www.scirra.com/arcade/shooting- ... ypse-11956

    Thank you onve again!

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