[SOLVED] Making a entity jump once

Hi, I am quite a noob when it comes to coding… I am trying to make an entity only jump once. but my current code is instead juts making it fly. what would an ideal script to allow the to jump once, or just even twice. Down bellow is the code I am using. also I am trying to make a 2d style game

    if(this.app.keyboard.isPressed(pc.KEY_SPACE)){
    this.entity.rigidbody.applyImpulse(0,1,0);}

Try this…

    if (this.app.keyboard.wasPressed(pc.KEY_SPACE)) {
        this.entity.rigidbody.applyImpulse(0, 1, 0);
    }

It definitely didn’t make it fly. the only problem is that. I want it to only jump once, or twice

Thanks. Fus_ion for helping me right now, and on the last previous question you answered.

1 Like