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;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement;
public class PlayerController : Player public class PlayerController : Player
{ {
@ -53,7 +54,9 @@ public class PlayerController : Player
isGrounded = Physics2D.OverlapArea(feetPos.position, checkRadius.position, whatIsGround); //return true for overlap isGrounded = Physics2D.OverlapArea(feetPos.position, checkRadius.position, whatIsGround); //return true for overlap
moveInput = Input.GetAxis("Horizontal"); 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); } if(_isGrounded && Input.GetAxis("Horizontal") != -1 && Input.GetAxis("Horizontal") != 1) { Player.rbody.velocity = new Vector2(0, Player.rbody.velocity.y); }

View File

@ -98,7 +98,7 @@ PlayerSettings:
visibleInBackground: 1 visibleInBackground: 1
allowFullscreenSwitch: 1 allowFullscreenSwitch: 1
graphicsJobMode: 0 graphicsJobMode: 0
fullscreenMode: 3 fullscreenMode: 1
xboxSpeechDB: 0 xboxSpeechDB: 0
xboxEnableHeadOrientation: 0 xboxEnableHeadOrientation: 0
xboxEnableGuest: 0 xboxEnableGuest: 0
@ -121,7 +121,7 @@ PlayerSettings:
m_SupportedAspectRatios: m_SupportedAspectRatios:
4:3: 0 4:3: 0
5:4: 0 5:4: 0
16:10: 1 16:10: 0
16:9: 1 16:9: 1
Others: 0 Others: 0
bundleVersion: 0.1 bundleVersion: 0.1