How can I make my Flappy jump only once when I click? I mean to execute just one click even if I press more. I want to jump again after I arrived on the land … Sorry for my bad english.
bool WasTouchedOrClicked()
{
if (Input.GetButtonUp("Jump") || Input.GetMouseButtonDown(0) ||
(Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Ended))
return true;
else
return false;
}
void MoveBirdOnXAxis()
{
transform.position += new Vector3(Time.deltaTime * XSpeed, 0, 0);
}
void BoostOnYAxis()
{
rigidbody2D.velocity = new Vector2(0, VelocityPerJump);
audio.PlayOneShot(FlyAudioClip);
}