courier/scripts/interactable.gd

27 lines
609 B
GDScript

extends Node
@export var ItemShown : Control
var selected = false
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
ItemShown.hide()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
#assign signals from the area2D that you want to show something when player steps
func _on_body_entered(body: Node2D) -> void:
if body.is_in_group("player"):
ItemShown.show()
selected = true
func _on_body_exited(body: Node2D) -> void:
if body.is_in_group("player"):
ItemShown.hide()
selected = false