karen_constantine

Untitled

Apr 9th, 2023
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class BirdController : MonoBehaviour
  4. {
  5. public float jumpForce = 5f;
  6. private Rigidbody2D rb;
  7.  
  8. void Start()
  9. {
  10. rb = GetComponent<Rigidbody2D>();
  11. }
  12.  
  13. void Update()
  14. {
  15. if (Input.GetKeyDown(KeyCode.Space))
  16. {
  17. rb.velocity = Vector2.up * jumpForce;
  18. }
  19. }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment