Pages

Tuesday, 14 November 2017

Advancing game further

As final step in our basic game development, we will add code to move the box right and left , add lose or win for better game play and generate box from random points. this clearly marks our levels but you can also do level based on another criteria say for every 100 boxes collected increase speed.

Add variable to store how fast we move the box public float MovementSpeed = 1; //speed in meter per second

Add new vector variable

Vector3 moveDir =Vector3.zero;

Add this to updatemoveDir.x = Input.GetAxis("Horizontal"); // get result of AD keys in X
This get the horizontal x distance to move based on key pressed.