Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. public float Forwardforce;
  2. public float Maxspeed;
  3. // Update is called once per frame
  4. void Update()
  5. {
  6. transform.localPosition += transform.forward * Forwardforce;
  7.  
  8. if (Input.GetKey("w") && Forwardforce < Maxspeed)
  9. {
  10. Forwardforce += 0.01f;
  11. }
  12. if (Input.GetKey("w") && Forwardforce > 0.2f)
  13. {
  14. Forwardforce -= 0.03f;
  15. }
  16. if (Input.GetKey("a"))
  17. {
  18. transform.Rotate(0, -1, 0);
  19. }
  20. if (Input.GetKey("d"))
  21. {
  22. transform.Rotate(0, -1, 0);
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement