Advertisement
Guest User

UDWBUDFBGVUBGDRUIGBIGERUBGRIUGBWFS

a guest
Oct 20th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #pragma strict
  2.  
  3. var facing: int = 0;
  4.  
  5. //1 is Left
  6. //0 is Right
  7.  
  8. function Start () {
  9.  
  10. }
  11.  
  12. function Update () {
  13.  
  14. if (Input.GetKeyDown("a")){
  15. if (facing == 0){ //Facing Right?
  16. transform.Rotate(Vector3.right * 180);
  17. facing = 1; //Facing Left
  18. }
  19. if (Input.GetKeyDown("d")){
  20. if (facing == 1){ //Facing Left?
  21. transform.Rotate(Vector3.right * 180);
  22. facing = 0; //Facing Right
  23. }
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement