for a school project I'm working on a simple game. I want to make the character jump using the
KX_CharacterWrapper. (it's necessary to use python since the project is about coding a game)
For the same character, I have a movements script using
walkDirection which works fine but the character just won't jump.
import bge def main(): cont = bge.logic.getCurrentController() own = cont.owner me = bge.constraints.getCharacter(own) keyboard = bge.logic.keyboard me.gravity = 9.81 me.maxJumps = 1 cont.jump_speed = 2 if keyboard.events[bge.events.SPACEKEY] == bge.logic.KX_INPUT_JUST_ACTIVATED: me.jump() main()
I assume the jump function works differently since the rest of the script like gravity works but I couldn't find an example. Thanks for any help.