func _on_Area2D_input_event(viewport, event, shape_idx):
var body = false
if event is InputEventMouseButton and event.button_index == BUTTON_LEFT:
if body == true:
anim_player.play_backwards("animation_name")
body = false
elif body == false:
anim_player.play("animation_name")
on_body = true
So I'm trying to make just ONE block of code run. What happens here is The elif statement would execute first, and then immediately after, the if statement code executes (probably because of the changed variable).
But I thought with if/elif, only ONE block of code runs.
I tried using RETURN but it still doesn't work.
I keep running into this problem and I don't know how to solve it. I'm so confused and would appreciate your help. Thanks a lot!