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 – saving the player's position


In a game with massive levels, the player may need to quit in the middle of a session. They could get frustrated if their position resets to the initial start zone instead of picking up where they left off; nobody wants to play the same part of the game twice just because they had to stop the first time:

  1. Implement a system that saves the player's current location whenever they exit the game and respawns them at their saved location whenever the game is started again.

    You can achieve this in the same way that you saved the number of coins, but keep in mind that the position data is stored as Vector3 and PlayerPrefs doesn't have a SetVector3 function.

    There isn't a single right way to go about saving data that's not natively supported by PlayerPrefs. Instead, it's all about how you want to implement the system and manipulate the data in a way that makes sense.

  2. Try saving each individual axis value as a floating-point number or an integer (using SetFloat...