Basically I’m developing a simple Snake Game very similar to “Curve Fever”.
I need a power up that I can collect, and will spawn in another random location in a random number of second.
Any idea on how to script this?
Thanks in advance
Basically I’m developing a simple Snake Game very similar to “Curve Fever”.
I need a power up that I can collect, and will spawn in another random location in a random number of second.
Any idea on how to script this?
Thanks in advance
Hide it and then show it again later in a new position:
function OnCollisionEnter(collision : Collision )
{
if (collision.collider.name == "Player") {
collision.collider.enabled = false;
renderer.enabled = false;
yield WaitForSeconds(Random.Range(3.0, 6.0));
// Whatever placement code you want
transform.position = Random.insideUnitSphere * 5.0;
collision.collider.enabled = true;
renderer.enabled = true;
}
}