How to do two actions with the same button


how to do two actions with the same button

my character jumps with the space bar and does another action with the space bar

the problem is that when the action ends it also jumps (that happens because the two actions are with the space bar)

any solution?


cómo hacer dos acciones con el mismo botón

mi personaje salta con la barra espaciadora y hace otra acción con la barra espaciadora

el problema es que cuando la acción termina también salta (eso pasa porque las dos acciones están con la barra espaciadora)

alguna solucion

Wrong Category. I moved it to game engine.

I think it would be also helpful to mention which game engine you use?

Of Course. Use the AND controller brick and connect sensors. Maybe like, if Player is in the air (jump) the key cant do anything else, and opposite. (Key = true AND Sensor = True → Play action 1; Key = true AND Sensor = False → Play action 2) You can also use flags, maybe properties, or read out Frame of the Animation. There are many way to do this.

You need to use conditions - if you don’t use python, but only logic blocks, use the object states to assign different actions to the space bar and switch states depending on the state of your object - in a jump, on the ground. If you use python, then you can use logical branching - “if elif else” to create multi-level logic and assign a lot of logical actions to the space bar, but for this you will need either global variables that you can call as global “variable” or properties where you can record the state of your object - for example, the string “jump” “ground” “swimming” and comparing the strings and the pressed key to perform actions

is that I am new to this page and I do not know how to use it well

(the engine is the new blender game engine)

seems like a good idea, but you could pass the file for better understanding

thanks you

Thank you very much, I think you could use the string property very useful

here that the file (it is a .blend it is for the new version UPBGE 2.79.7)