[Unity2D] Creating your Level (Unity version 5.x)

Information
Step 1
In this lesson we are going to learn how to create a background, floors, objects and a CameraFollow Script!
Ezgif.com video to gif %281%29
Information
Step 2
Before starting this lesson, check to make sure you have the correct version. This is Unity 5.x.
Temp1550440137

5.x means it can be 5.(anything). So 5.5.0, 5.4, 5.3, 5.2, 5.anything is fine.

But if you're using version 2017-2018 then you should click on 2017-2018 version of creating a level!

https://www.mvcode.com/lessons/unity2d-creating-your-level-unity-version-2017-2018-tina-instructor

Step 3
Let's go on the internet and import some new assets. Look up some free 2D game tile sets!
Step 4
Let's delete that white floor! Using the [Delete] button or Right Click and Delete.
Temp1550446636
Step 5
Remember how to import a folder or zip/rar file? No worries, time for a refresher! First we extract this to its own name
Temp1550447411

We only want the png folder so delete all the other folders.

Going back to the freetileset folder, we'll click and drag this folder into our Unity project tab.

Step 6
Now let's create a background! Find the Background image and click & drag it into your scene!

You might want to enlarge the background image by either using the enlarge tool or increase the x & y scale.

Temp1550449866

I kept mines at size 10 for x and y

Step 7
Copy and Paste another background and put them side by side. Hold down CTRL while moving for it to clip.
  1. Select the background
  2. Hold CTRL, then press C to Copy.
  3. Hold CTRL, then press V to Paste.
  4. Click and drag your select background out to the right.
  5. Hold CTRL while moving your background so that it can clip onto your first background.
Step 8
Let's find your tile set now! Locate them in your project tab.
Step 9
Create an empty object in the Hierarchy called "Platform". Make sure the XYZ position is ALL at 0.
Step 10
Next let's click and drag these 3 platform objects into our Scene, also make sure all their XYZ position is 0!
Temp1550617550 Temp1550617574
Step 11
If your platform looks a little too small, increase the XYZ scales! I increase all of mines to (5,5,5) scale.
Temp1550617751
Step 12
Find the left and right edge of the platform and position them correctly like this.
Step 13
Move your tile objects into the Platform empty object, so that they'll all become one piece.
  1. Select the first one.
  2. Hold down shift and click the last one to select all between first and last.
  3. Click and drag into "Platform".
  4. Select "Platform" and try moving it around! (It should all move as one piece)
Step 14
Give this platform a BoxCollider2D and adjust the collider green box so that it covers all of the platform.
Temp1550618365

Once you finish putting the BoxCollider2D, remember to put our platform under our player!

Check Your Work
Step 15
Time to see if this platform works! Click play and our player should be able to stand on top of it and fall off.
Step 16
We want to save this platform as a "Prefab" so we can use it over and over again in the future.

Create a new Folder called "Prefabs"

Temp1550618728 Temp1550618758

Open the prefabs folder

Temp1550618921

Now click and drag our "Platform" into the prefabs folder to create a prefab of it.

Step 17
Let's try our prefab! Click and drag our platform prefab all over your world. And maybe put another one near you.
Check Your Work
Step 18
Click play to see if other platforms work.
Challenge
Step 19
Try doing the same thing to create your floor!
Temp1550619712

Hints:
1. You can put more than one BoxCollider2D on one object.
2. You can copy one block, paste it, readjust it, then copy both blocks, repeat for 2 blocks, 4 blocks, 8 blocks, 16 blocks, and so on.

Check Your Work
Step 20
Test out your game once you've finished creating your platforms and floors!
Planning
Step 22
You can further customize your level! If you are using the default pack, look for the objects folder.
Temp1550876900
Step 23
Simply click and drag objects into your project! Uh oh, our object (tree) isn't shown, what is happening?
Information
Step 24
How do we know something is behind or in front of another object? Behind or in front of background
Temp1550877559

We have this thing called the Sorting Layer and the Order in Layer.
* The higher the number, the more it is in FRONT
* The lower the number, the more it is BEHIND

Temp1550877722

In this example, 0 is the most behind and 6 is the most in front.

[Warning] If the above happens, that means they're on the same layer, the player and the tree. Did you want the tree to be behind or in front of the player?

Step 34
You and finished with this lesson! Click on submit and continue.
[Unity2D] Creating your Level (Unity version 5.x) Info

Account

MVCode Clubs

Created By

Nepgear tina (instructor)

Course:

2D Platformer Game

Access Level

premium

For Teachers and Schools

Teach coding to your students with MVCode Teach

MVCode offers an integrated product designed to teach coding to students.

Learn more about MVCode Teach