Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | VilmakerStudios |
I’m making a platformer and I want the character to duck, I can do it with different collision shapes, but I want to recognize when there’s something on top of me so i don get up and glitch. if is_on_floor(): if Input.is_action_pressed("ui_down"): $AnimatedSprite.play("Duck") $Normal.set_disabled(1) $Duck.set_disabled(0) elif $DuckDetection.(I_dont't know what to put here)(): $Normal.set_disabled(1) $Duck.set_disabled(0) else: $Normal.set_disabled(0) $Duck.set_disabled(1)
“Normal” is my standing collision shape, “Duck” is my ducking Collision shape and “DuckDetection” is the area i want to use to detect the ceiling.
I’m new to Godot so please explain.
Can you please format multilined code like this instead? It’s much easier to read.
if is_on_floor():
if Input.is_action_pressed("ui_down"):
$AnimatedSprite.play("Duck")
$Normal.set_disabled(1)
$Duck.set_disabled(0)
elif $DuckDetection.(I_dont't know what to put here)():
$Normal.set_disabled(1)
$Duck.set_disabled(0)
else:
$Normal.set_disabled(0)
$Duck.set_disabled(1)
SIsilicon | 2018-10-12 17:00