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
+20 -4
View File
@@ -1,11 +1,27 @@
class_name EnemyController
extends Node
signal accelerate(direction: Vector2, delta: float)
signal shoot(weapon_index: int)
signal shoot()
@export var ship: AbstractEnemyShip
var target_position : Vector2
var direction : Vector2
func _physics_process(delta: float) -> void:
for i in 10:
shoot.emit(i)
accelerate.emit(Vector2.ZERO, delta)
if ship.is_on_screen:
shoot.emit()
accelerate.emit(direction, delta)
func _on_direction_timer_timeout() -> void:
direction = get_acceleration_direction()
func get_acceleration_direction() -> Vector2:
return (target_position - ship.position).normalized()