diff --git a/src/game/player_controller.gd b/src/game/player_controller.gd index d8c38d1..a362dbb 100644 --- a/src/game/player_controller.gd +++ b/src/game/player_controller.gd @@ -36,19 +36,19 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): + var dec_d = dec * delta + if momentum.length() > dec_d: + momentum -= momentum.normalized()*dec_d + else: + momentum = Vector2(0,0) + if !dead: var acc_d = acc * delta - var dec_d = dec * delta var rev_d = rev * delta var turn_d = turn_speed * delta var brake_d = brake_strength * delta var turn_factor = 1 - if momentum.length() > dec_d: - momentum -= momentum.normalized()*dec_d - else: - momentum = Vector2(0,0) - if Input.is_action_pressed("accelerate"): momentum += acc_d * Vector2(1,0).rotated(rotation) @@ -77,7 +77,7 @@ func _process(delta): $engine_sounds.pitch_scale = get_speed_proportion() + .2 else: - rotate(PI*delta) + rotate(PI*delta * get_speed_proportion()) if momentum.length() > max_speed: momentum = momentum.normalized() * max_speed speed_changed.emit(momentum.length())