From the course: Unity 4: 2D Essential Training

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Deadly obstacles

Deadly obstacles - Unity Tutorial

From the course: Unity 4: 2D Essential Training

Start my 1-month free trial

Deadly obstacles

So now that we have our door, our trigger, and our push block, which represent the puzzle based objects in our game, next let's take a look at how we can build some obstacles that'll actually do damage to the player. To do this, let's create a new scene, and we're going to call this deadly obstacles staging. We're going to save this to our scenes folder and from here, we're going to go to our prefab folder, we'll drag our test platform and our player into the scene. Next, let's go into the artwork, inside Sprite sheets and look for our spikes. Here, we're going to drag the single spike into the screen. We'll position this a little bit above the player. We can also name this single spike and we can drag it back into the prefab folder. Next, let's add a collider to it. Here, we'll have a box collider 2D. And we're going to set this to be a trigger. Next thing we want to do are tag any objects that'll do damage, to the player as being deadly. We can go into the Tag drop-down and select…

Contents