game: add bleed
This commit is contained in:
@@ -17,7 +17,9 @@ var modifiers: Array[EnemyMod] = []
|
||||
@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D
|
||||
@onready var shape_cast_2d: ShapeCast2D = $ShapeCast2D
|
||||
@onready var sprite_2d: Sprite2D = $Sprite2D
|
||||
@onready var label: Label = $Label
|
||||
@onready var label: Label = $HBoxContainer/Label
|
||||
@onready var effect_container: HBoxContainer = $HBoxContainer/EffectContainer
|
||||
|
||||
|
||||
var player: Player
|
||||
var enemy_name: String
|
||||
@@ -26,9 +28,11 @@ var god_mode: bool = false
|
||||
var is_dead: bool = false
|
||||
var health: float
|
||||
|
||||
var effects: Array[EnemyEffectBase]
|
||||
|
||||
var _path_update_timer: float = 0.0
|
||||
var _compute_cache: KeyedCache = KeyedCache.new()
|
||||
|
||||
var _effects_visible = []
|
||||
|
||||
func _ready() -> void:
|
||||
enemy_name = _gen_name()
|
||||
@@ -63,6 +67,15 @@ func _find_player():
|
||||
func _gen_name() -> String:
|
||||
return "Unnamed enemy"
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
for effect in effects:
|
||||
if effect in _effects_visible:
|
||||
continue
|
||||
var effect_sprite = Sprite2D.new()
|
||||
effect_sprite.texture = preload("res://assets/sprites/small_bleed_icon.png")
|
||||
effect_container.add_child(effect_sprite)
|
||||
_effects_visible.append(effect)
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if not target:
|
||||
|
Reference in New Issue
Block a user