#jump function not working when 2 characters are in the scene
9 messages · Page 1 of 1 (latest)
i put print(name, " ", is_on_floor(), " ", coyote_timer.time_left) as the first line in my handle_jump() function
it outputs:
WhitePlayer false 0
BlackPlayer false 0
WhitePlayer false 0
BlackPlayer false 0
WhitePlayer false 0
BlackPlayer false 0
WhitePlayer false 0
BlackPlayer false 0
...
Does the black one, work by itself too? @crisp wave
Are you using the same script for both players?
I am suspecting that both players using same script and that they are not in perfect sync and they are getting the condition of being on the floor mixed up.
I suggest trying for troubleshooting, separating the players jump conditions. One for the white and one for black, each one gets tested is_on_floor separate.
func handle_jump():
if PLAYER == "white" and (is_on_floor() or coyote_timer.time_left > 0.0) and Input.is_action_just_pressed("jump"):
velocity.y = movement_data.jump_velocity
if PLAYER == "black" and (is_on_floor() or coyote_timer.time_left > 0.0) and Input.is_action_just_pressed("jump"):
velocity.y = movement_data.jump_velocity
Please change to your own variables.
I faxed it alr, forgot to close this, thanks!
Sweet! What did you end up needing to change?
i think jump velocity, tbh i forgot haha