Jump?

How do I make my character jump with animation? and an animation when it landed on the ground.

Hello
first you make your animations!
Then use “states”
State 1
Keyboard Sensor -> AND -> Action Actuator - Jump animation
…-> State Actuator - Copy to state 2
State 2
Collision or Touch Sensor ( to detect the floor) -> AND -> Action Actuator - other animation
…-> State Actuator - copy to state 1 ( or other)
It should work…I hope?!
Bye

This is a .blend I’ve made for another member :

Note : Press Space to Jump.
I’ve added two properties : “grounded” and “state(name)” to give you a visual on what’s happening.
See Debug properties on the top left of your screen.
Those properties are not needed to make the jump/fall action work, but it can be useful later for combinations of actions (like…
if grounded==0 and jump_key is pressed then double jump).
If you don’t need it, you can clean it.

On the second state (jump) you can play with the Delay sensor > Delay variable to change the duration of the jump before falling. (Debug properties, see how fast the change from jump to fall is made).
You can also play with the jump_action Actuator Z axis linV value to modify the vertical speed for the jump.
You can also change gravity settings when falling (Fall state->gravity motion). The force applied on Z axis can be modified.

This setup sends a message to the armature “idle”, “jump”, “fall”.
I don’t have time to add it, but you can try for yourself.
This is something that you already know how to do.

The fall state is useful if you add special attacks/actions when falling.
In that case, Jump and fall animations are two different actions.

Otherwise, if you don’t need a fall state, you can switch back to the init state directly (after ground collision) : in that case, you can use a unique jump/fall action.

Later, you will also find using Python to be a clean solution.

Download link : jump_states.blend

Oto
Please note that it would be better to use “Add Jump State” than “Copy Jump state” so you can keep the sensors/controllers/actuators defined in the first state active.
Example : jump and move left/right/front/back
Otherwise, you would have to define your sensors in the second state again.

I presume that you were not talking about states on the armature because you talked about collision sensor, armatures are usually set to “no collision”.

The jumping animation works! but the falling and landing animation are kinda hard to get. I dont know anything about states and properties yet.

cray
thank you for the complementary information!
Bye