Hello all!
What problem I'm facing is currently trying to change the character's state to kinematic to rigid by having the threshold of the
health to 0 or lower than. I tried doing signals to work it hasn't, I tried using the other solution in a different discussion though that doesn't work. I'm still clueless of what's wrong
extends Spatial
var Enemy_HP = 100
var trigger
onready var hint = $"3D hint"
onready var anim = $"AP".get_animation("Test")
#onready var target = $"../3D hint"
onready var Tar = $"Player"
onready var rag = [get_node("Head"),get_node("ArmR"),get_node("ArmL"),get_node("Chest"),get_node("LegR"),get_node("LegL")]
signal hit
func _ready():
_ragdoll()
anim.set_loop(true)
$"AP".play("Test")
func _damage():
Enemy_HP -= 10
print(Enemy_HP)
pass
func _ragdoll():
if Enemy_HP <=0:
for rigid_body in rag:
rigid_body.mode = RigidBody.MODE_RIGID
return true
else:
for rigid_body in rag:
rigid_body.mode = RigidBody.MODE_KINEMATIC
rigid_body.add_to_group("enemy")
func _physics_process(delta):
_ragdoll()
if _ragdoll() == true:
_ragdoll()
$"AP".stop(true)
pass