Hi I wanted to make cannon like in Mario Bros.
Right now it shoots bullets. I have 4-second looped animation so the bullet restarts in the cannon efter hitting the wall. So here comes the problem, bullet can either hit me and be destroyed or go through me, hit the wall and restart in cannon. I want it to hit me and then restart in the cannon.
My code so far:
#pragma strict
var bullet : GameObject;
var effect : Transform;
function OnTriggerEnter ()
{
Destroy(bullet);
Instantiate(effect, transform.position, transform.rotation);
}
function Update () {
}