04-05-2016, 09:52 AM
Ecco a voi lo script (scusate per i nomi strani) : using UnityEngine;
using System.Collections;
public class vitapermoneta : MonoBehaviour {
GameObject moneta;
GameObject nemico;
// Use this for initialization
void Start () {
moneta = GameObject.FindWithTag ("moneta");
nemico = GameObject.FindWithTag ("nemico");
}
// Update is called once per frame
void Update () {
}
void OnCollisionEnter2D(Collision2D collisione)
{
if(collisione.gameObject.tag == "Player")
Destroy(nemico);
}
}
using System.Collections;
public class vitapermoneta : MonoBehaviour {
GameObject moneta;
GameObject nemico;
// Use this for initialization
void Start () {
moneta = GameObject.FindWithTag ("moneta");
nemico = GameObject.FindWithTag ("nemico");
}
// Update is called once per frame
void Update () {
}
void OnCollisionEnter2D(Collision2D collisione)
{
if(collisione.gameObject.tag == "Player")
Destroy(nemico);
}
}