Open lgtyqz opened 5 years ago
This is because the init()
method of the JumpState
is not getting a chance to execute because the tilt AttackState
is being pushed to stack after the JumpState
in the same frame.
The CharacterState only calls the init()
method when its update()
method is called (here) and the update()
method for a CharacterState is only called if it is at the top of the stack.
Yeah, realized that. My current solution for AIs is to do:
player.jump()
if player.getYVel() < -1:
player.tilt()
We'll have to explain that to the participants
maybe add a yield() function to wait until the next frame?
The python interpretor does not support coroutines so a yield would not work in this case.
So if you try to get the AI to jump and then input a move, the AI will just use the move without jumping.
Sample Code:
No jumping occurs when this code is used. Can anyone help me with this?