this is working kinda but looses the accelerator
This commit is contained in:
parent
0aff08887e
commit
6d0b178fa9
2 changed files with 10 additions and 7 deletions
|
|
@ -128,6 +128,6 @@ func format_time(time : float, include_minutes : bool) -> String:
|
|||
func _on_intro_player_finished() -> void:
|
||||
state = State.game
|
||||
music_player.play()
|
||||
#for player in players:
|
||||
#player.start_engine()
|
||||
for player in players:
|
||||
player.start_engine()
|
||||
|
||||
|
|
|
|||
13
player.gd
13
player.gd
|
|
@ -5,19 +5,21 @@ var id : int = 0
|
|||
var score : int = 0
|
||||
var scorecard : Scorecard
|
||||
var alive : bool = true
|
||||
var lifetime : float = 0
|
||||
@export var start_speed = 100
|
||||
|
||||
@export var animated_sprite : AnimatedSprite2D
|
||||
|
||||
func _ready() -> void:
|
||||
var frame : int = randi_range(0, animated_sprite.sprite_frames.get_frame_count("default")-1)
|
||||
var direction : Vector2 = Vector2 (randf_range(-1,1), randf_range(-1,1))
|
||||
|
||||
apply_force( direction.normalized() * start_speed)
|
||||
|
||||
#animated_sprite.frame = frame
|
||||
|
||||
|
||||
func start_engine():
|
||||
var direction : Vector2 = Vector2 (randf_range(-1,1), randf_range(-1,1))
|
||||
|
||||
apply_force( direction.normalized() * start_speed)
|
||||
|
||||
func setup():
|
||||
animated_sprite.frame = id
|
||||
|
|
@ -31,8 +33,9 @@ func respawn_shiny():
|
|||
func _process(delta: float) -> void:
|
||||
scorecard.score = score
|
||||
scorecard.alive = alive
|
||||
if(linear_velocity.length() < 35):
|
||||
linear_velocity *= 1.1
|
||||
lifetime += delta
|
||||
#if(linear_velocity.length() < 35 and lifetime > 3):
|
||||
#linear_velocity *= 1.1
|
||||
if(not alive):
|
||||
modulate = Color("ffffff42")
|
||||
contact_monitor = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue