Book Image

OUYA Game Development by Example

By : John Donovan
Book Image

OUYA Game Development by Example

By: John Donovan

Overview of this book

The OUYA console and development kit gives you the power to publish video games for the players, creating a console marketplace of the gamers, for the gamers, and by the gamers. Using the OUYA developer kit and the Unity3D game engine, even beginners with a captivating game idea can bring it to life with a hint of imagination. OUYA Game Development by Example uses a series of feature-based, step-by-step tutorials that teach beginners how to integrate essential elements into a game engine and then combine them to form a polished gaming experience.
Table of Contents (18 chapters)
OUYA Game Development by Example Beginner's Guide
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – linking your tutorial to your game


Your tutorial level is ready to play, but we still need a way to access it. We'll accomplish this by adding another button to your title screen directly underneath the start button. Perform the following steps to link the tutorial:

  1. Open the scene named TitleScreen and double-click on the StartButton.cs script to open it in your code editor.

  2. Add the following lines of code in your OnGUI function to create a tutorial button immediately below the start button:

    void OnGUI()
    {
      if(GUI.Button(new Rect(Screen.width / 2 – 50, Screen.height / 2 + 25, 100, 50), "Start"))
      {
        Application.LoadLevel("level1");
      }
    
      //create a tutorial button
      if(GUI.Button(new Rect(Screen.width / 2 – 50, Screen.height / 2 + 125, 100, 50), "Tutorial"))
      {
        Application.LoadLevel("TutorialScreen");
      }
    }

    Much like the start and reset buttons, the code for the tutorial button is uniform with the others; we only needed to edit the button text and the linked level...