Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class BirdController : MonoBehaviour
- {
- public float jumpForce = 5f;
- private Rigidbody2D rb;
- void Start()
- {
- rb = GetComponent<Rigidbody2D>();
- }
- void Update()
- {
- if (Input.GetKeyDown(KeyCode.Space))
- {
- rb.velocity = Vector2.up * jumpForce;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment