The Escape Key is a Feature

We gotta get the heck outta here.

We’ve come a long way in just three weeks, but now we have a fully playable arcade shooter. There’s only one problem: the player is trapped in our game. No, this isn’t an episode of Sword Art Online — though, that would be cool — there’s just no way to quit the application. That’s right, quitting the game is a feature. And while we all know your game is highly addictive and nobody should want to quit, let’s go ahead and make it possible anyhow.

In order to provide our players with an easy means of escape, we’ll need to head into the code. All the user input has been on the Player script so far, but what if the player is dead? That will leave the player staring at the Game Over screen, taunted by the enemies they failed to defeat. Instead we’ll use the Game Manager script.

In the Update method we need to sneak a small block of code to enable the escape key:

Super easy, but easy to overlook.

That’s all there is to this tidbit. The next few articles will focus on adding features to the shooter to flesh it out and give it some play longevity and professional polish.

Unity Developer / Game Developer / Artist / Problem Solver