Well, you've got if is_on_floor() and is_on_wall()
- with an "and" that might never evaluate as true. Put a print within the branch to check. It sounds like an or
would be more appropriate.
If not, check the reverse, that it's not being called multiple times.
Here's my son's code from the Pong game I mentioned in case it helps. This is working fine:
func bounce():
if transform.origin.y < ball_size or transform.origin.y > screen_size.y - ball_size:
direction.y = -direction.y
func _physics_process(delta):
bounce()
goal()
move_and_slide(direction.normalized() * speed * delta)
if get_slide_count():
direction = -direction