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.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if !dead:
|
|
||||||
var acc_d = acc * delta
|
|
||||||
var dec_d = dec * 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:
|
if momentum.length() > dec_d:
|
||||||
momentum -= momentum.normalized()*dec_d
|
momentum -= momentum.normalized()*dec_d
|
||||||
else:
|
else:
|
||||||
momentum = Vector2(0,0)
|
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"):
|
if Input.is_action_pressed("accelerate"):
|
||||||
momentum += acc_d * Vector2(1,0).rotated(rotation)
|
momentum += acc_d * Vector2(1,0).rotated(rotation)
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ func _process(delta):
|
||||||
|
|
||||||
$engine_sounds.pitch_scale = get_speed_proportion() + .2
|
$engine_sounds.pitch_scale = get_speed_proportion() + .2
|
||||||
else:
|
else:
|
||||||
rotate(PI*delta)
|
rotate(PI*delta * get_speed_proportion())
|
||||||
if momentum.length() > max_speed:
|
if momentum.length() > max_speed:
|
||||||
momentum = momentum.normalized() * max_speed
|
momentum = momentum.normalized() * max_speed
|
||||||
speed_changed.emit(momentum.length())
|
speed_changed.emit(momentum.length())
|
||||||
|
|
Loading…
Reference in a new issue