Problem with making my actor jump properly

hi guys.
so i come onto this project that I'm doing every day, hoping that I've come up with the solution to this problem, but i just can't get my head round this one. I've linked a basic version of my project into this post. Id like for my actor to jump (height depending on length of power bar) and then only be able to jump again AFTER he has landed on the floor again. Id like it so that the player has to release the mouse button again before he can jump again, because at the moment the player can hold the mouse button as the actor is in mid air, and as soon as the actor lands on the floor the power bar will start going up, but this time when released the actor won't jump, so the player has to press mouse button again. any1 know how to fix this? again I've linked the project, so you can see for yourself the problem I'm having. cheers guys :)

Comments

  • MarpCarkMarpCark Member Posts: 121

    any ideas anyone? this is literally the last thing i have to do. once this is fixed my game is ready for publishing. cheers :)

  • iknowdavehouseiknowdavehouse Member Posts: 7

    If I've understood your question properly... There's a couple of ways to do this that I can think of..

    Collide Rule

    Set up a rule for your jump to sit inside that says - When actor overlaps or collides with "floor" (whatever your floor is called) > then your jump rule. That means the jump only works when your actor is colliding with the floor. You'll have to set up this for anything else he might need to jump on, like a platform. You can put this all within the same rule and select "when any of these are true".

    Using Attributes

    You could also do the same thing using attributes. Set a boolean attribute called "grounded" and leave it unchecked. Then in your rules for movement you can say - When actor overlaps or collides with floor - change attribute "grounded" to true.

    Then you do the same as above and set ups rule that says - when "grounded = true" > your jump rules. That means the actor can only jump when he is grounded... You can also set "otherwise > grounded = false" in the same rule to be safe.

Sign In or Register to comment.