2 D - Project

Hey Folks :slight_smile:

I’d like to start a 2D Platformer in Unity as a school Project … I just downloaded Unity 3.0 and I do have to say it’s prety awesome !!! :slight_smile:

I tried the 2D Platformer tutorial … but either I’m realy stupid or just blind I cant find how to limit the movement to to the y and x - achis. Furthermore I can’t seem to let the camera follow the Player in a 2D Platformer style …

Can you help me? Do you know a nice tutorial I could use?

Cheers!

Dawnreaver

the limit to x and y is trivial: just don’t offer them any movement possibility in z direction :slight_smile:

if all movement from input only result in movement along x and y they won’t go anywhere else basically

Uhm … could you explain with an example? as I said I’m a blody beginner -_-’

Welcome to the forum, Dawnreaver!

In PlatformerController.js, you’ll notice the following function:-

function FixedUpdate () {
	// Make sure we are absolutely always in the 2D plane.
	transform.position.z = 0;
}

FixedUpdate gets called on a regular basis rather like Update. The function sets the character’s Z position to zero regularly so it will stay in the XY plane.

Now that is a great script.

Thank you

Hey folks :slight_smile:

I got the player - thingy to run on the z axis wooot!

Now I need to restrict the camera … everytime i go left or right the camera turns by 180° but I like it to stay stady… Any Ideas what I do wrong?

I used the Smooth-Follow script in the main camera and targeted the “player”

Cheers!

Dawnreaver