// Update is called once per frame void Update() { Horizontal = cantmove?0:Input.GetAxisRaw("Horizontal"); Vertical = cantmove?0:Input.GetAxisRaw("Vertical"); if (Horizontal != 0 && Vertical != 0) { return; } RotatePlayer(); Vector3 p = transform.position; tilecolor = playerphysics.DetectTile(p, 5, Blocks); if (Input.GetKeyDown(KeyCode.Q)) { ChangeColor(0); } if (Input.GetKeyDown(KeyCode.W)) { ChangeColor(1); } if (Input.GetKeyDown(KeyCode.E)) { ChangeColor(2); } if (tilecolor != null) { ChangePlayerState(tilecolor); } if (Input.GetButtonDown("Horizontal") || Input.GetButtonDown("Vertical")) { playerphysics.DetectWalls(ref Horizontal, ref Vertical, p, MoveStep, WallMask); Vector3 final = new Vector3(MoveStep * Horizontal, MoveStep * Vertical, 0); transform.position += final; } if (playerphysics.levelcomplete) { GameManager gm = Camera.main.GetComponent <GameManager>(); gm.LevelComplete(); } if (Input.GetKeyDown(KeyCode.Escape)) { if (Application.CanStreamedLevelBeLoaded("MainMenu")) { Application.LoadLevel("MainMenu"); } } }