feat: implement walking and killable enemy dummy entities and player movement controller base

This commit is contained in:
DottsGit
2026-06-06 21:00:45 -04:00
parent eb9344c0bb
commit 54dfd342c2
3 changed files with 35 additions and 9 deletions
+13
View File
@@ -11,6 +11,7 @@ var max_shield: float = 100.0
var shield: float = 100.0
var is_dead: bool = false
var time_since_last_damage: float = 0.0
var ragdoll_instance: Node3D = null
var pending_impulse: Vector3 = Vector3.ZERO
var recent_attackers: Dictionary = {}
@@ -39,6 +40,16 @@ func _ready() -> void:
_update_label()
func _process(delta: float) -> void:
if is_dead:
return
time_since_last_damage += delta
if time_since_last_damage >= 5.0 and shield < max_shield:
shield += 20.0 * delta
if shield > max_shield:
shield = max_shield
_update_label()
func take_damage(amount: float, hit_position: Vector3, source: Node = null, _impulse: Vector3 = Vector3.ZERO) -> void:
if is_dead:
return
@@ -55,6 +66,8 @@ func take_damage(amount: float, hit_position: Vector3, source: Node = null, _imp
if attacker_id != 0:
recent_attackers[attacker_id] = Time.get_ticks_msec() / 1000.0
time_since_last_damage = 0.0
var dmg_taken = amount
if shield > 0:
if shield >= amount: