2.5D Platformer - Moving left/right, camera Qs

Hey there,

I’ve been using Unity for a couple of years but from an asset point of view, never from a coding point of view. I started working on a project recently, but have no idea how to script some stuff, which is why I’m asking for some help.

So I’m working on a 2.5D platformer, this is what I’ve got thus far:

I’d love some help on how to get a character in there, and control it with the keyboard (left/right+W/D keys) left and right in the same plane, not allowing it to move off the plane. Keep in mind I have 0 knowledge with coding, so would love help to not assume stuff.

Secondly, I’d also love some help with making the camera follow the character smoothly. Any help is much appreciated! :slight_smile:

A

Not got too much time to assist but this should give you some idea on how to proceed. Attach the script to your character.

Also, if you want to learn and start being self sufficient as a programmer you have to read, and read a lot! :slight_smile:

#pragma strict


var moveSpeed : float;


function Start () {
	moveSpeed = 5.0; // Change movespeed here to start with a faster or slower speed of movement.
}


function Update () {


	if ( Input.GetKey(KeyCode.LeftArrow) ) {
		transform.position.x -= moveSpeed * Time.deltaTime;
	}
	
	if ( Input.GetKey(KeyCode.RightArrow) ) {
		transform.position.x += moveSpeed * Time.deltaTime;
	}
	
}