2d movement

I i am making a castle crashers like 2d game and i would like to know how to get the movement to use the x and y axis not just the x axis like a mario gamehow would i go about completing this task. and as well how do i set like a 2d flor to where i can walk anywhere inside of it but i collide with the walls on the sides top and bottom so that i dont fall off. I am probably wording this very hard and sorry for that but if you could please help me resolve this issue it would be SO much appreciated thanks and have a nice day.

It is possible to complete such a project in Unity2D, but i don’t even have to think about it for more than a minute before i come across in issue: Jumping. Because you’re only moving, and you use both of those dimensions for legitimate player movement, jumping either requires an unnecessary layer-system, or a third dimension!

A game can still be flat and 2D, yet have three dimensions.

Create a Unity3D Project, place all your sprites and components how you would in front of the camera as if it was a 2D project. Change the camera’s Projection to Orthographic, adjust whatever other settings you want until it feels right.

In Castle Crashers, you have an angled ground, flat foreground and background setting. Just create a Plane with the ground texture at an angle to the camera so it appears to be angled in the orthographic view. The background can be flat or sideways, whatever suites you. When it comes to moving up and down - like in Castle Crashers - move the player on the z-axis and y-axis using Sin/Cosin such that the player is always on the plane which acts as your ground.

When jumping, simply modify only the y-axis.

Done (sorta)

If you need a more detailed tutorial or lesson, contact me through one of the available contacts on my profile.