// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.UpArrow) && (transform.position.y < ScreenTopY)) //Did we try to move up and won't go off screen? { newPosition = new Vector2(-25, transform.position.y + 12); } else if (Input.GetKeyDown(KeyCode.DownArrow) && (transform.position.y > ScreenBotY))//Did we try to move Down and won't go off screen? { newPosition = new Vector2(-25, transform.position.y - 12); } transform.position = Vector2.MoveTowards(transform.position, newPosition, moveSpeed * Time.deltaTime); //Move without snapping to the location immediately. if (Input.GetKeyDown(KeyCode.R)) { //Reload Scene SnakeLoader.loadSnake(SnakeLoader.Scenes.SnakeGameScene); } if (Input.GetKeyDown(KeyCode.Escape)) { //Return to Title SnakeLoader.loadSnake(SnakeLoader.Scenes.MainMenu); } if (Input.GetKeyDown(KeyCode.Q)) { //Quit Game Debug.Log("Game is Exiting.."); //Kill the Game Application.Quit(); } }
// Update is called once per frame void Update() { if (updated == false) { updated = true; SnakeLoader.LoaderResume(); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { //Player Dies, main menu //BalloonController.playSound(SoundManager.SFX.pop); SnakeLoader.loadSnake(SnakeLoader.Scenes.BalloonScene); Destroy(gameObject); } }
private void UserInput() { if (Input.GetKeyDown(KeyCode.Escape)) { //Return to Title SnakeLoader.loadSnake(SnakeLoader.Scenes.MainMenu); } if (Input.GetKeyDown(KeyCode.Q)) { //Quit Game Debug.Log("Game is Exiting.."); //Kill the Game Application.Quit(); } if (Input.GetKeyDown(KeyCode.RightShift)) { //Right Shift, skip to balloon debugger. SnakeLoader.loadSnake(SnakeLoader.Scenes.BalloonScene); } }
private void UserInput() { //Leave 180 turn option as kill. if (Input.GetKeyDown(KeyCode.UpArrow)) { snekDirection = Direction.Up; } if (Input.GetKeyDown(KeyCode.DownArrow)) { snekDirection = Direction.Down; } if (Input.GetKeyDown(KeyCode.RightArrow)) { snekDirection = Direction.Right; } if (Input.GetKeyDown(KeyCode.LeftArrow)) { snekDirection = Direction.Left; } ///////////////////////////////////////// ///Menu Buttons////////////////////////// ///////////////////////////////////////// if (Input.GetKeyDown(KeyCode.R)) { //Reload Scene SnakeLoader.loadSnake(SnakeLoader.Scenes.SnakeGameScene); } if (Input.GetKeyDown(KeyCode.Escape)) { //Return to Title SnakeLoader.loadSnake(SnakeLoader.Scenes.MainMenu); } if (Input.GetKeyDown(KeyCode.Q)) { //Quit Game Debug.Log("Game is Exiting.."); //Kill the Game Application.Quit(); } }
public static void gds() { SnakeLoader.loadSnake(SnakeLoader.Scenes.BalloonScene); }
public void title() { Debug.Log("Going back to title scene."); //To Main Menu SnakeLoader.loadSnake(SnakeLoader.Scenes.MainMenu); }
public void retry() { Debug.Log("Scene being Reloaded!"); //Reload Scene SnakeLoader.loadSnake(SnakeLoader.Scenes.SnakeGameScene); }
public void startSnake() { Debug.Log("Game is being Started!"); //Reload Scene SnakeLoader.loadSnake(SnakeLoader.Scenes.SnakeGameScene); }