fix enemy aligning, add sticks respawn

This commit is contained in:
2026-04-23 11:42:17 +03:00
parent c9489321ae
commit 52d0b00655
2 changed files with 43 additions and 7 deletions
+24 -4
View File
@@ -108,11 +108,31 @@ func _spawn_rocks() -> void:
for i in range(limit):
_spawn_single_rock()
var sticks_on_field: int = 0
var sticks_pending: int = 0
const STICK_LIMIT := 2
func _spawn_sticks() -> void:
for i in range(2):
var stick := STICK_SCENE.instantiate()
stick.position = _safe_item_position()
add_child(stick)
for i in range(STICK_LIMIT):
_spawn_single_stick()
func _spawn_single_stick() -> void:
var stick := STICK_SCENE.instantiate()
stick.position = _safe_item_position()
add_child(stick)
stick.connect("destroyed", _on_stick_destroyed)
sticks_on_field += 1
func _on_stick_destroyed() -> void:
sticks_on_field = maxi(0, sticks_on_field - 1)
if not game_active:
return
if sticks_on_field + sticks_pending < STICK_LIMIT:
sticks_pending += 1
await get_tree().create_timer(20.0).timeout
sticks_pending -= 1
if game_active:
_spawn_single_stick()
func _spawn_single_rock() -> void:
var rock := ROCK_SCENE.instantiate()