O'Reilly logo

Ouya Unity Game Development by Gary Riches

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making the character move

Our game is shaping up nicely, we have the level-building code complete and the camera will, in theory, follow the player around when they move. Let's put that to the test.

As in the previous chapter, we'll get all the input working with the keyboard and then implement the Ouya input.

We are going to make it so the person playing the game can turn left, turn right, and move forward. This will always happen one tile at a time.

Edit your Sokoban script file and add the following code below the int amountOfCrates = 0; line:

GameObject theCrate;
bool isPlayerMoving;
bool isPlayerRotating;
int rotationSpeed;
int movingSteps;
int tRow;
int tCol;

The items these variables will represent are:

  • theCrate: This is a reference to the crate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required