16 lines
516 B
GDScript
16 lines
516 B
GDScript
extends Area2D
|
|
|
|
@export var interact_text = "INTERACT"
|
|
var game = null
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
if !game: return
|
|
|
|
if (body.get_name() == "PlayerGround") or (game.get_node("PlayerGround").is_ancestor_of(body)):
|
|
game.current_interaction_area = self
|
|
|
|
func _on_body_exited(body: Node2D) -> void:
|
|
if !game: return
|
|
|
|
if (body.get_name() == "PlayerGround") or (game.get_node("PlayerGround").is_ancestor_of(body)):
|
|
if game.current_interaction_area == self: game.current_interaction_area = null
|