1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-22 08:04:23 +00:00
hella-farm/entities/gold.gd

22 lines
425 B
GDScript3
Raw Normal View History

2024-04-13 17:07:26 +00:00
extends Node2D
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