Hello, small top-down shooter for class project, Godot 4. Two problem, maybe one bug, maybe two.
1. Bomb. Player pick up bomb, it call kill_all() on wave manager. With 10 enemy, only 5 die. The other 5 stay and the wave never clear. I print alive_enemies.size() before and after bomb. Before it say 10, after it say 5. I think maybe bomb run at wrong time in the frame, so I try call_deferred on it. Still confusing. In my old Godot 3 project a loop like this work fine.
func kill_all() -> void:
for e in alive_enemies:
e.take_damage(9999)
func _on_enemy_died(enemy: Enemy) -> void:
alive_enemies.erase(enemy)
score += 10
take_damage emit died, then queue_free().
2. Movement. I move player in _process because I want smooth:
func _process(delta: float) -> void:
var dir := Input.get_vector("move_left", "move_right", "move_up", "move_down")
velocity = dir * speed
move_and_slide()
My laptop is OK. Friend with 144 Hz monitor say player faster and stick on wall corner.
Is this frame timing for both? Or two different bug?