fix game not ending when cars despan after others finished

This commit is contained in:
interfisch 2025-05-24 08:35:32 +02:00
parent b3245eba93
commit ff6abb0a94
2 changed files with 16 additions and 6 deletions

View file

@ -470,10 +470,10 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -576.0
offset_top = -289.0
offset_right = -241.0
offset_bottom = -175.0
offset_left = -483.861
offset_top = -287.132
offset_right = -148.861
offset_bottom = -173.132
grow_horizontal = 2
grow_vertical = 2
theme = SubResource("Theme_lsv84")

View file

@ -157,7 +157,17 @@ func checkCarsTimeout(delta: float):
if !c.hasFinished() and c.getNoInputTimeout():
print("Removing car")
c.queue_free()
if cars.size()<=0 and !game_ended: #no cars left
if !game_ended:
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):