diff --git a/entities/gold.gd b/entities/gold.gd index 9edb2dd..edc5fa9 100644 --- a/entities/gold.gd +++ b/entities/gold.gd @@ -2,6 +2,9 @@ extends Node2D class_name Gold +@export var speed_up_factor := 8.0 + + @onready var game: MainGame = MainGame.get_via_group(self) @onready var move_towards: MoveTowards = %"MoveTowards" @onready var collect_sound_spawner: Spawner = %"CollectSoundSpawner" @@ -22,3 +25,7 @@ func collect() -> void: func _on_move(movement: Vector2) -> void: position += movement + +func _physics_process(delta: float) -> void: + if move_towards.target != null: + move_towards.speed *= pow(speed_up_factor, delta) diff --git a/entities/gold.tscn b/entities/gold.tscn index 44584a3..2678b77 100644 --- a/entities/gold.tscn +++ b/entities/gold.tscn @@ -9,12 +9,13 @@ [ext_resource type="PackedScene" uid="uid://eqg6snsgn1kh" path="res://players/gold_pickup_player.tscn" id="6_eoeje"] [sub_resource type="CircleShape2D" id="CircleShape2D_w1h35"] -radius = 64.0 +radius = 96.0 [sub_resource type="CircleShape2D" id="CircleShape2D_jm7yp"] [node name="Gold" type="Node2D"] script = ExtResource("1_lbls1") +speed_up_factor = 8.0 [node name="Collectible" parent="." instance=ExtResource("2_j75yq")] unique_name_in_owner = true @@ -38,7 +39,6 @@ debug_color = Color(0, 0.388235, 0.815686, 0.219608) [node name="MoveTowards" parent="." instance=ExtResource("5_bcbgf")] unique_name_in_owner = true -speed = 184.0 [node name="CollectSoundSpawner" parent="." instance=ExtResource("5_t7ey8")] unique_name_in_owner = true