Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development How to Make a Video Game Score, Enemies, and Game State Add a Start and End

Jack McAllister
Jack McAllister
1,129 Points

Error: NotImplementedException The frog can move around without pressing Space

}

// Update is called once per frame
void Update()
{
    // If the game is not started and the player pressed the space bar
    if (gameStarted == false && Input.GetKeyUp(KeyCode.Space))
    {

        // ...start the game
        StartGame();
    }

    // If the player is no longer alive...
    if (playerHealth.alive == false)
    {

        // ...end the game
        EndGame();

        // ...increment a timer to count up to restarting...
        restartTimer = restartTimer + Time.deltaTime;

        // ...and if it reaches the restart delay...
        if (restartTimer >= restartDelay) {

            // ...then reload the currently loaded level.

            Application.LoadLevel(Application.loadedLevel);