I am trying to make a mini game within my main game where you fly around as a bird and drop poop lol.
I have already programmed a decent flying script, and have a prefab for the poop. I cannot figure out how to make the prefab drop from the character with getmousebuttondown. Can anyone help me with a script??
In your bird script:
public GameObject pooPrefab;
void Update () {
if (Input.GetMouseButtonDown(0))
{
Instantiate(pooPrefab, this.transform.position, Quaternion.identity);
}
}
In your poo script:
public float fallSpeed = 1f;
void Update() {
transform.position = new Vector3(transform.position.x,
transform.position.y - (fallSpeed * Time.deltaTime),
transform.position.z);
}