Some code style fixes. Fixed enemy spawning
This commit is contained in:
@@ -6,12 +6,12 @@ signal accelerate(direction: Vector2, delta: float)
|
||||
signal shoot()
|
||||
|
||||
|
||||
@export var ship: AbstractEnemyShip
|
||||
|
||||
|
||||
const FREE_FLIGHT_DIST = 50
|
||||
|
||||
|
||||
@export var ship: AbstractEnemyShip
|
||||
|
||||
|
||||
var target_position : Vector2
|
||||
var direction : Vector2
|
||||
|
||||
@@ -23,10 +23,10 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
|
||||
func _on_direction_timer_timeout() -> void:
|
||||
direction = get_acceleration_direction()
|
||||
direction = _get_acceleration_direction()
|
||||
|
||||
|
||||
func get_acceleration_direction() -> Vector2:
|
||||
func _get_acceleration_direction() -> Vector2:
|
||||
var distance := ship.position.distance_to(target_position)
|
||||
|
||||
if distance < FREE_FLIGHT_DIST:
|
||||
|
||||
@@ -2,9 +2,6 @@ class_name EnemySwampController
|
||||
extends Node
|
||||
|
||||
|
||||
@export var passage : Passage
|
||||
|
||||
|
||||
const SMALL_ENEMY = preload("res://game/entities/ships/enemies/small/small_enemy_ship.tscn")
|
||||
const MEDIUM_ENEMY = preload("res://game/entities/ships/enemies/medium/medium_enemy_ship.tscn")
|
||||
const HEAVY_ENEMY = preload("res://game/entities/ships/enemies/heavy/heavy_enemy_ship.tscn")
|
||||
@@ -21,6 +18,9 @@ const MIN_POSITION = Vector2(300, 30)
|
||||
const MAX_POSITION = Vector2(600, 330)
|
||||
|
||||
|
||||
@export var passage : Passage
|
||||
|
||||
|
||||
@onready var enemy_update_timer : Timer = $EnemyUpdateTimer
|
||||
|
||||
|
||||
|
||||
@@ -21,5 +21,6 @@ func _input(event: InputEvent) -> void:
|
||||
if not input_direction.is_zero_approx():
|
||||
blink.emit(input_direction)
|
||||
|
||||
|
||||
func _get_input_direction() -> Vector2:
|
||||
return Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||
|
||||
Reference in New Issue
Block a user