hey!
so I’ve a bird which starts to move when I test the game but I want a script where it would be stationary until the player clicks on the start button and it starts to move. take a look at my bird script and please help on what to add and where to add.
thanks!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Bird : MonoBehaviour
{
public float upForce = 150f;
private bool isDead = false;
private Rigidbody2D rb2d;
private Animator anim;
//USE THIS FOR INITIALIZATION
void Start()
{
rb2d = GetComponent<Rigidbody2D>();
anim = GetComponent<Animator>();
}
//update is called ocnce per frame
void Update()
{
if (isDead == false)
{
if (Input.GetMouseButton(0)) {
rb2d.velocity = Vector2.zero;
rb2d.AddForce(new Vector2(0, upForce));
anim.SetTrigger("Flap");
}
}
}
void OnCollisionEnter2D()
{
rb2d.velocity = Vector2.zero;
isDead = true;
anim.SetTrigger("Die");
GameControl.instance.BirdDied();
}
}
@hexagonius yeah I’m sorry man i didnt check the image and i tried to add as a comment but it said i’ve got insufficient permissions to even add a comment