# 2D game building

I want to make my 2D game side view so that in a mansion, there are rooms above (climb with ladders), below (more ladders) and to either side of the rooms with an end to the mansion after approximately 7 rooms in each direction. However, I have no clue how to make the gravity and platforms work. I’m probably overthinking it. Need quite a bit of help!

well i’m not good with unity, but i believe you could use a rigidbody and freeze it’s x and y when you “climb” your ladder, and just manually manipulate the position. there are plenty of tutorials on the rest of a 2d controller. if by platforms you meant moving platforms, then just

``````OnCollisionEnter(Collider 2D WhateverYouWantToNameIt) {
if (WhateverYouWantToNameIt.tag == "your moving platform tag")//(casesensitive)
//do stuff to add the x&y movements of the platform to you
}

}
``````

You are working in 2d, so dont forget that. Whether it is top down, side scrolling, etc…it is still 2d space. This means that the rooms on the sides/above/below could just as easily be walls surrounding a room from a top down view. The art would be the visual cue that we are playing a sidescroller rather than a top down.

You could use a rigidbody for gravity, or you can simulate your own for more control (though gravity is a pretty universal thing)

To simulate gravity, just apply a force in the direction you want the gravity to take effect. Cast a ray from the players position “down”. Use colliders on a ground layer of your choice. If a ray of a certain length (usually a length that ends a tiny bit below the characters feet) hits the ground collider, you are grounded. If not, apply the simulated gravity force.

I havent done a lot of 2d work inside unity, but I do know that unity has a whole collection of tools available for 2d games.

https://unity3d.com/learn/tutorials/topics/2d-game-creation/rigidbody-2d?playlist=17093

https://unity3d.com/learn/tutorials/topics/2d-game-creation/collider-2d

This video will show you the way most people doing 2D sidescrollers handle moving platforms:

The series this video is a part of is pretty good if you’re just trying this kind of thing out for the first time.