2024-04-13 17:07:26 +00:00
|
|
|
extends Node2D
|
2024-04-14 02:07:35 +00:00
|
|
|
class_name Gold
|
2024-04-13 17:07:26 +00:00
|
|
|
|
|
|
|
|
2024-04-21 21:20:02 +00:00
|
|
|
@onready var move_towards: MoveTowards = $"%MoveTowards"
|
|
|
|
@onready var collect_sound_spawner: Spawner = $"%CollectSoundSpawner"
|
2024-04-14 02:39:45 +00:00
|
|
|
|
|
|
|
|
2024-04-21 21:20:02 +00:00
|
|
|
func magnetize(cursor: Cursor) -> void:
|
|
|
|
move_towards.target = cursor
|
2024-04-14 02:39:45 +00:00
|
|
|
|
2024-04-21 21:20:02 +00:00
|
|
|
func demagnetize() -> void:
|
|
|
|
move_towards.target = null
|
|
|
|
|
|
|
|
func collect() -> void:
|
|
|
|
collect_sound_spawner.spawn()
|
2024-04-14 02:39:45 +00:00
|
|
|
queue_free()
|
2024-04-21 21:20:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_move(movement: Vector2) -> void:
|
|
|
|
position += movement
|