20 lines
530 B
GDScript
20 lines
530 B
GDScript
extends Node2D
|
|
|
|
@export var range : int = 50
|
|
|
|
func _process(_delta: float) -> void:
|
|
if has_node("%Player"):
|
|
if %Player.global_position.distance_to(global_position) < range:
|
|
show_ins()
|
|
else:
|
|
hide_ins()
|
|
|
|
func show_ins():
|
|
var tween = create_tween()
|
|
tween.tween_property(self, "modulate:a", 1, 0.2)
|
|
tween.parallel().tween_property(self, "position:y", -23, 0.2)
|
|
|
|
func hide_ins():
|
|
var tween = create_tween()
|
|
tween.tween_property(self, "modulate:a", 0, 0.2)
|
|
tween.parallel().tween_property(self, "position:y", -16, 0.2)
|