I'm making a 2D game where the player has to collect green orbs while dodging grey orbs. I want to make proximity mines, where if the player gets too close they will explode and 6 grey orbs will fire out in all directions.
I've got the proximity part set up and working with this script:
var targetObj : GameObject;
var proximity : float = 3;
function Update() {
var dist = Vector3.Distance(targetObj.transform.position, transform.position);
if (dist < proximity) {
Destroy(targetObj);
}
}
I just don't know how to get it to create 6 grey orbs after the mine object is destroyed and have them shoot out. I know it has to do with Instantiate, but I couldn't get it to work correctly. Any help would be greatly appreciated.