Reworked player controller
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user