Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Tato64 |
Hello wonderful members of the community!
Long story short:
I shoot an enemy (my projectile is a raycast), i want his sprite to change accordingly.
Im using animatedsprite to handle character sprites, relevant code is the following:
if hasgun and Input.is_action_just_pressed("lclick"):
if $Pistol/RayCast2D.get_collider().is_in_group("enemy"):
print($Pistol/RayCast2D.get_collider().name) #just for debugging
$Pistol/RayCast2D.get_collider().Body.play("dead")
But this is not working.
(“Body” in the last line is the name of the AnimationPlayer)