blob: c9c0c8359c944bf1fc782162cc6edfdbd3779245 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
extends Area2D
@export var attraction_range: float = 0.0
@export var attraction_speed: float = 0.0
@onready var player: Area2D = get_node("../../Player")
func type() -> String: return "coin"
func _ready() -> void:
rotation = randf()
func _process(delta: float) -> void:
rotation += delta * 50
func _physics_process(_delta: float) -> void:
var dist := player.position - position
if dist.length() < attraction_range:
position += dist.normalized() * attraction_speed
|