Hi,
I'm looking into making Springs for my platformer, it's been readonably straight forward so far and it's all working apart from one thing.

The Spring is made up of:

Area2D
..AnimatedSprite
..CollisonShape2D

The problem is that the Player doesn't always detect his collision after the first bounce. Sometimes he'll do it once and then land on the ground and totally go through the Spring/Mushroom. Other times he'll bounce twice when landing on the Spring. Occasionally he'll bounce 4 times. Something isn't in sync.

Here's part of my script:

#SET IF ON THE GROUND OR NOT
    if is_on_floor():
        if not onGround:
            $FootDust.restart() # Reset the Particle effect so that it's not half way though
            $FootDust.emitting = true
            onGround = true
    else:
        onGround = false
        if myVelocity.y < 0:
            $AnimatedSprite.play("Jump")
        if myVelocity.y > 0 :
            $AnimatedSprite.play("Fall")

            #BOUNCE PLAYER ON SPRING/MUSHROOM
            if playerSpringJump:
                print("Player on Spring!")
                myVelocity.y = -springJumpPower

Here's my collison on the Area2D:

I've obviously tested with Print statements to debug, but other than telling me what I already know, it doesn't help for something that is buggy intermittently.

Edit: I have noticed that if I reduce the springJumpPower the Player's collision works better.
I'm guessing my update isn't quick enough to catch the Player every time.

    JayBanana

    I've found a fix, my Gravity was being added to constantly in the fall, so much so the Player was going through the Area2D completely. So I created a Terminal Velocity variable to prevent the Player's gravity from constantly increasing.

    const TERMINALVELOCITY = 250
    
    if myVelocity.y > TERMINALVELOCITY:
    	myVelocity.y = TERMINALVELOCITY