Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma strict
- var facing: int = 0;
- //1 is Left
- //0 is Right
- function Start () {
- }
- function Update () {
- if (Input.GetKeyDown("a")){
- if (facing == 0){ //Facing Right?
- transform.Rotate(Vector3.right * 180);
- facing = 1; //Facing Left
- }
- if (Input.GetKeyDown("d")){
- if (facing == 1){ //Facing Left?
- transform.Rotate(Vector3.right * 180);
- facing = 0; //Facing Right
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement