I am creating a very small game, a side scroller.
I have loops that generate the floor tiles and some game elements like starting location cube and end location cube etc.
However, I need some help with the player movement.
I create a cube as my player.
I have to turn my players cube 90 degrees in the Y for this code to work.
I have to use the up / down arrow keys.
// PLAYER CONTROL AND MOVEMENT
var speed = 5.0;
function Update () {
var x = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
var z = Input.GetAxis("Vertical") * Time.deltaTime * speed;
transform.Translate(x, 0, z);
}
How can I adapt this code so I can use the left and right arrow keys to move the player left and right.
If you can show me how to implement a simple jump as well that would be awesome.
Thanks for any help in advance.