fix game not ending when cars despan after others finished
This commit is contained in:
parent
b3245eba93
commit
ff6abb0a94
2 changed files with 16 additions and 6 deletions
|
@ -470,10 +470,10 @@ anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
offset_left = -576.0
|
offset_left = -483.861
|
||||||
offset_top = -289.0
|
offset_top = -287.132
|
||||||
offset_right = -241.0
|
offset_right = -148.861
|
||||||
offset_bottom = -175.0
|
offset_bottom = -173.132
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
theme = SubResource("Theme_lsv84")
|
theme = SubResource("Theme_lsv84")
|
||||||
|
|
|
@ -157,8 +157,18 @@ func checkCarsTimeout(delta: float):
|
||||||
if !c.hasFinished() and c.getNoInputTimeout():
|
if !c.hasFinished() and c.getNoInputTimeout():
|
||||||
print("Removing car")
|
print("Removing car")
|
||||||
c.queue_free()
|
c.queue_free()
|
||||||
if cars.size()<=0 and !game_ended: #no cars left
|
if !game_ended:
|
||||||
end_game()
|
if cars.size()<=0: #no cars left
|
||||||
|
print("No Cars Left")
|
||||||
|
end_game()
|
||||||
|
|
||||||
|
var cars_finished=0
|
||||||
|
for c in cars:
|
||||||
|
if c.hasFinished():
|
||||||
|
cars_finished+=1
|
||||||
|
if cars_finished >= cars.size() : #all cars left have finished
|
||||||
|
print("All Remaining Cars finished")
|
||||||
|
end_game()
|
||||||
|
|
||||||
func updateCameraMovement(delta: float):
|
func updateCameraMovement(delta: float):
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue