Press ESC to get back to main menu

This commit is contained in:
Christer
2020-04-30 01:56:05 +03:00
parent f32ce4c982
commit b13dbcb87b
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class PlayerController : Player
{
@ -53,7 +54,9 @@ public class PlayerController : Player
isGrounded = Physics2D.OverlapArea(feetPos.position, checkRadius.position, whatIsGround); //return true for overlap
moveInput = Input.GetAxis("Horizontal");
if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } //temporary exit measure
if (Input.GetKeyDown(KeyCode.Escape)) {
SceneManager.LoadScene(0);
}
if(_isGrounded && Input.GetAxis("Horizontal") != -1 && Input.GetAxis("Horizontal") != 1) { Player.rbody.velocity = new Vector2(0, Player.rbody.velocity.y); }