I’m trying to recreate flappy bird. I have the wing object attached to the bird object, but i want to make it so every time i press spacebar, the wing moves down- then goes back to it’s original position to look like it’s flapping. But i’m just completely stumped. This is the code i have so far.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Birdwingright : MonoBehaviour
{
public bool WingFlapDown = true;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space) == true)
transform.Rotate(new Vector3(-1, 0, 0));
}
}