Added enemy movement

This commit is contained in:
2025-11-24 23:30:57 +03:00
parent fb6b00be7c
commit b4529a407b
10 changed files with 71 additions and 25 deletions
+8 -6
View File
@@ -7,14 +7,16 @@ signal accelerate(direction: Vector2, delta: float)
signal shoot(weapon_index: int)
const WEAPON_ACTIONS := {
0: "shoot_weapon_1",
1: "shoot_weapon_2",
}
func _physics_process(delta: float) -> void:
var input_direction := Input.get_vector("move_left", "move_right", "move_up", "move_down")
accelerate.emit(input_direction, delta)
var weapon_actions := {
0: "shoot_weapon_1",
1: "shoot_weapon_2",
}
for index : int in weapon_actions:
if Input.is_action_pressed(weapon_actions[index]):
for index : int in WEAPON_ACTIONS:
if Input.is_action_pressed(WEAPON_ACTIONS[index]):
shoot.emit(index)