added enemy health bar and target with markers
This commit is contained in:
@@ -5,7 +5,7 @@ signal last_enemy_dead()
|
||||
var player
|
||||
var last_enemy : bool = false
|
||||
|
||||
@export var health = 3
|
||||
@export var start_health = 3
|
||||
@export var SPEED = 3.0
|
||||
@export var loot_amount = 2
|
||||
const MAX_LV = 10
|
||||
@@ -58,6 +58,8 @@ $body/leg3/leg3outline,
|
||||
$body/leg4/foot4/foot4outline,
|
||||
$body/leg4/leg4outline,
|
||||
$body/bodyoutline]
|
||||
@onready var health_bar_sprite: Sprite3D = $HealthBarSprite
|
||||
|
||||
|
||||
var gravity = 9.8
|
||||
var particlespawn
|
||||
@@ -73,11 +75,13 @@ var player_in_view = false
|
||||
var player_last_seen
|
||||
var knocked = false
|
||||
var stunned = false
|
||||
var health
|
||||
|
||||
func _ready():
|
||||
health = start_health
|
||||
player = level_control.player
|
||||
#health_bar_sprite.visible = false
|
||||
turret_material.emission_enabled = false
|
||||
|
||||
#randomly start the postfire timer so enemy turrets aren't synced
|
||||
var random_time = randf_range(0,5)
|
||||
await get_tree().create_timer(random_time).timeout
|
||||
@@ -124,6 +128,8 @@ func _process(delta):
|
||||
|
||||
|
||||
func _on_area_3d_body_part_hit(dam,bullet_damage):
|
||||
health_bar_sprite.visible = true
|
||||
health_bar_sprite.health_update()
|
||||
if !dying:
|
||||
health -= dam * bullet_damage
|
||||
if health <= 0:
|
||||
@@ -243,6 +249,7 @@ func save():
|
||||
"rot_x" : rotation.x,
|
||||
"rot_y" : rotation.y,
|
||||
"rot_z" : rotation.z,
|
||||
"start_health" : start_health,
|
||||
"health" : health
|
||||
}
|
||||
return save_dict
|
||||
|
||||
Reference in New Issue
Block a user