Crystalline-awakening/collectables/crystal/collect_crystal.gd

20 lines
496 B
GDScript3
Raw Normal View History

2025-05-17 17:38:34 +00:00
extends Area2D
2025-05-17 17:04:03 +00:00
2025-05-18 13:55:49 +00:00
signal crystal_picked_up
2025-05-18 12:35:48 +00:00
2025-05-18 10:14:53 +00:00
func _ready():
2025-05-18 13:40:05 +00:00
add_to_group("crystals")
2025-05-17 17:38:34 +00:00
func _on_body_entered(body: Node2D) -> void:
2025-05-18 13:55:49 +00:00
if body.name == "player":
emit_signal("crystal_picked_up")
queue_free()
func _on_mouse_collision_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
2025-05-21 16:44:18 +00:00
var destination: Vector2 = get_global_mouse_position()
global_position = global_position.move_toward(destination, 1.0)
2025-05-21 17:01:21 +00:00
#git is shit