Added slowdown during death
This commit is contained in:
parent
131f2472b7
commit
687604fc05
1 changed files with 7 additions and 7 deletions
|
@ -36,19 +36,19 @@ func _ready():
|
|||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
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 !dead:
|
||||
var acc_d = acc * delta
|
||||
var rev_d = rev * delta
|
||||
var turn_d = turn_speed * delta
|
||||
var brake_d = brake_strength * delta
|
||||
var turn_factor = 1
|
||||
|
||||
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())
|
||||
|
|
Loading…
Reference in a new issue