Reworked player controller

This commit is contained in:
2025-11-09 22:30:22 +03:00
parent 213a0d60ed
commit 22aaeab0aa
23 changed files with 181 additions and 158 deletions
@@ -2,18 +2,9 @@ extends AbstractProjectile
@export var deceleration : int
@export var livetime : int
func _ready() -> void:
super._ready()
var livetime_timer := Timer.new()
add_child(livetime_timer)
livetime_timer.wait_time = livetime
livetime_timer.one_shot = true
livetime_timer.timeout.connect(queue_free)
livetime_timer.start()
@onready var livetime_timer := $LivetimeTimer
func _physics_process(delta: float) -> void:
@@ -27,3 +18,7 @@ func _process_acceleration(delta: float) -> void:
_velocity -= _velocity.normalized() * current_deceleration
else:
_velocity = Vector2.ZERO
func _on_livetime_timer_timeout() -> void:
queue_free()
@@ -18,9 +18,10 @@ region = Rect2(0, 16, 16, 16)
radius = 7.0
[node name="MinelayerProjectile" instance=ExtResource("1_ufc4r")]
collision_layer = 0
collision_mask = 0
script = ExtResource("2_hwwfa")
deceleration = 100
livetime = 60
damage = SubResource("Resource_px1i2")
speed = 200
@@ -29,3 +30,10 @@ texture = SubResource("AtlasTexture_ckqco")
[node name="CollisionShape2D" parent="." index="1"]
shape = SubResource("CircleShape2D_ufc4r")
[node name="LivetimeTimer" type="Timer" parent="." index="3"]
wait_time = 60.0
one_shot = true
autostart = true
[connection signal="timeout" from="LivetimeTimer" to="." method="_on_livetime_timer_timeout"]