Godot Version
4.3
Question
My code is not working. I am attempting to create a door and have done the animation already, however the code won’t work:
Area.gd
extends Area2D
var can_open_door = false
var door_opened = false
connect area signal
func _on_body_entered(body):
if body == $Player:
can_open_door = true
connect area signal
func _on_body_exited(body):
if body == $Player:
can_open_door = false
func _input(event):
if event is InputEventKey:
if event.scancode == KEY_E and can_open_door:
if door_opened:
close_door(q)
else:
open_door(e)
# Toggle door_open bool
door_opened = !door_opened