added corpses and a wall building dissolve animation
This commit is contained in:
@ -4,14 +4,14 @@ class_name EnemyController
|
||||
signal reached_goal(enemy, penalty)
|
||||
signal died(enemy)
|
||||
|
||||
@export var stats : Enemy
|
||||
@export var status_manager : StatusEffector
|
||||
@export var movement_controller : EnemyMovement
|
||||
@export var health : Health
|
||||
@export var sprite : Sprite3D
|
||||
@export var health_bar_gradient : Gradient
|
||||
@export var stats: Enemy
|
||||
@export var status_manager: StatusEffector
|
||||
@export var movement_controller: EnemyMovement
|
||||
@export var health: Health
|
||||
@export var sprite: Sprite3D
|
||||
@export var corpse_scene: PackedScene
|
||||
|
||||
var movement_speed
|
||||
var movement_speed: float
|
||||
var movement_speed_penalty := 1.0
|
||||
var alive = true
|
||||
|
||||
@ -19,8 +19,7 @@ var alive = true
|
||||
func _ready() -> void:
|
||||
health.max_health = stats.health
|
||||
health.current_health = stats.health
|
||||
$SubViewport/ProgressBar.max_value = stats.health
|
||||
$SubViewport/ProgressBar.value = stats.health
|
||||
$SubViewport/HealthBar.setup(stats.health)
|
||||
sprite.texture = stats.sprite.duplicate()
|
||||
movement_speed = stats.movement_speed
|
||||
|
||||
@ -40,11 +39,8 @@ func die():
|
||||
if alive:
|
||||
alive = false
|
||||
died.emit(stats)
|
||||
var corpse = corpse_scene.instantiate()
|
||||
corpse.set_sprite(stats.death_sprite)
|
||||
corpse.position = global_position
|
||||
Game.level.corpses.add_child(corpse)
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_health_health_changed(value) -> void:
|
||||
$SubViewport/ProgressBar.value = value
|
||||
var percent = float(health.current_health) / float(health.max_health)
|
||||
$SubViewport/ProgressBar.tint_progress = health_bar_gradient.sample(percent)
|
||||
$SubViewport/ProgressBar.set_visible(true)
|
||||
|
Reference in New Issue
Block a user