![]() ![]() We also need to add a Rigidbody2D component. Capsule collider allows us to glide much smoother. We’re not using a box collider because they can get stuck if moving along a surface with multiple other colliders. Then set the tag, layer, and sorting layer to “Player”. Before jumping into scripting it, we need to set up a few things first.ĭrag the “Player_Default” sprite into the scene (part of the Player sprite sheet). For me I used a blue/green color (hexadecimal: 4BC1AC). Click on the camera and change the “Clear Flags” property to Solid Color. So what we’re going to do is change the color to something a bit more ‘alien’. Now at the moment, our background is just the default blue. In our case we’re having 4 possible answers, but you can have as many as you want. This basically means that it’s on the same layer as the ship but it will render in-front. Then, set the sorting layer to “Ship” and add a BoxCollider2D component, resizing it so it fits the ship.įor our tubes, we’re going to drag in the “Tube” sprite, add a BoxCollider2D, set the tag to “Entrance” and sorting layer to “Ship” with an order in layer to 1. You may see that it’s a bit too small, so just increase the scale to 1.15. Next, drag in the “Ship” sprite to the top of the frame. Now duplicate that tile and lay them out horizontally along the bottom border of the camera frame. If you don’t have a “Floor” tag, just add one. To make the floor usable, we need to add a BoxCollider2D component to the tile and set its tag to “Floor”. Then, drag in the “GroundTile” sprite as a child of the object. This is going to be where we store all of our ground tiles. Now create an empty GameObject (right-click Hierarchy > Create Empty), and call it “Ground”. Note: Make sure that the sorting layers are in that specific order, as this determines what sprites render in front of others. Sorting Layers: Background, Jetpack, Player, Obstacle, Ship, UI If you’ve downloaded the project files and are using that, then you can skip this step. Go to the Game window and set the aspect ratio to 16:9.įor this project, we’re going to need to add in some tags, sorting layers, and one layer. Since we’re working in 2D and the fact that we’re utilizing the whole height and width of the screen, it’s important that it’s consistent across most platforms. This is due to the scale we’re working with. Then we need to make sure that our “Main Camera” has an orthographic size of 5. First of all, create a new 2D Unity project. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |