Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Player : MonoBehaviour
- {
- public bool front = true;
- public bool back = false;
- // Start is called before the first frame update
- void Start()
- {
- front = false;
- back = true;
- transform.Rotate (0,0,0);
- }
- // Update is called once per frame
- void Update()
- {
- if (Input.GetKeyDown(KeyCode.D)) {
- if (front == true)
- {
- transform.Rotate (0,180,0);
- front = false;
- back = true;
- }
- }
- if (Input.GetKeyDown(KeyCode.A) )
- {
- if (back == true)
- {
- transform.Rotate (0,-180,0);
- back = false;
- front = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement