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 – reading mouse position in Unity


To begin, we'll create a GUI object that displays the x and y coordinates of our mouse as we move it. We'll be able to observe the range and current position of the mouse, which we can then use to write a gesture function. Perform the following steps to read mouse position:

  1. Open the Create menu in the Hierarchy window and select GUI Text to create a new text object.

  2. Your default GUI Text object will appear as shown in the following screenshot:

    We don't want this text to obscure our game at all, so we'll reposition it to stay in the upper-left corner of the screen.

  3. Click on the GUI Text object in the Hierarchy window to display it in the Inspector window.

  4. Change the X and Y values of the GUI Text object's Transform component to 0 and 1, respectively.

  5. Change the color of the text in the object by selecting a new color from the Color field in the GUIText component.

    After performing the previous two steps, your GUI Text object should appear as shown...