Tune and optimize boss encounter
This commit is contained in:
parent
40f284dcdd
commit
68985316e5
16 changed files with 316 additions and 88 deletions
|
|
@ -6,15 +6,19 @@ signal destroyed
|
|||
const COMBAT_TARGET = preload("res://core/CombatTarget.gd")
|
||||
|
||||
@export var marked: bool = false
|
||||
@export var max_hp: int = 2
|
||||
@export var max_hp: int = 5
|
||||
@export var speed: float = 245.0
|
||||
@export var acceleration: float = 520.0
|
||||
|
||||
var boss: Node2D
|
||||
var hp: int = 2
|
||||
const REDRAW_INTERVAL: float = 1.0 / 12.0
|
||||
|
||||
var hp: int = 5
|
||||
var velocity: Vector2 = Vector2.ZERO
|
||||
var phase: float = 0.0
|
||||
var dead: bool = false
|
||||
var redraw_left: float = 0.0
|
||||
var fleet: Node2D = null
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
|
@ -23,12 +27,14 @@ func _ready() -> void:
|
|||
add_to_group("boss_minions")
|
||||
COMBAT_TARGET.register(self, COMBAT_TARGET.DANGER_PRIORITY)
|
||||
phase = randf() * TAU
|
||||
fleet = get_tree().get_first_node_in_group("player_fleet")
|
||||
queue_redraw()
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
phase += delta
|
||||
var fleet: Node2D = get_tree().get_first_node_in_group("player_fleet")
|
||||
if not is_instance_valid(fleet):
|
||||
fleet = get_tree().get_first_node_in_group("player_fleet")
|
||||
if fleet != null and not fleet.ships.is_empty():
|
||||
var to_fleet: Vector2 = fleet.get_centroid() - global_position
|
||||
if to_fleet.length() > 1.0:
|
||||
|
|
@ -38,7 +44,10 @@ func _physics_process(delta: float) -> void:
|
|||
if velocity.length() > 4.0:
|
||||
rotation = lerp_angle(rotation, velocity.angle() + PI / 2.0,
|
||||
7.0 * delta)
|
||||
queue_redraw()
|
||||
redraw_left -= delta
|
||||
if redraw_left <= 0.0:
|
||||
redraw_left = REDRAW_INTERVAL
|
||||
queue_redraw()
|
||||
|
||||
|
||||
func take_damage(amount: int) -> bool:
|
||||
|
|
|
|||
Loading…
Reference in a new issue