- Home /
Question by
missypooh · Mar 05, 2012 at 02:31 AM ·
animationscriptableobject
Collide with worm deduct BP and kill the worm
Basically i will have an worm prefab walking around the scene. So if the player collide with the worm, it will have deduct on their's BP. As i need the enemy prefab to be walking around the scene once started, i create an animation for the worm and check the 'IsTrigger'. So if the player collide with the worm, it will lose its BP. But i don't understand why there is no effect (mean no deduction of the BP).
Next, i want the player to be able to kill the worm, like "stepping" on them and the enemy prefab will be destroy. Quite similar to the super mario game. How can i do it?? thank you.
if(hit.gameObject.tag == "worm")
{
HealthControl.LIVES -= 1;
print(HealthControl.LIVES);
// play a sound clip at the exact position we hit the object
AudioSource.PlayClipAtPoint(hitSound, transform.position);
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613064751im_/https://answers.unity.com/themes/thub/images/avi.jpg)