netmasked/scripts/world_logic.gd

13 lines
426 B
GDScript

extends Node2D
@onready var player : Player = get_tree().get_first_node_in_group("player")
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if player:
if player.global_position.distance_to(global_position) > 600:
player.damage()