Godot Version
Godot 4
Question
Using the code below is_on_ceiling() returns true when the player is on the floor and is_on_floor() returns true when the player is on the ceiling. Am I doing something wrong? I can’t seem to figure out why this happens?
func _physics_process(delta):
if not is_on_ceiling():
velocity.y += 980 * delta
else:
print("On floor")
if is_on_floor():
print("On ceiling")
if Input.is_action_just_pressed("up"):
velocity.y = 400
var direction = Input.get_axis("left", "right")
if direction:
velocity.x = direction * 130
else:
velocity.x = move_toward(velocity.x, 0, 130)
move_and_slide()