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.
Exploding the player - Unity Tutorial
From the course: Unity 4: 2D Essential Training
Exploding the player
So, at this point, our Explode script isn't very dramatic. What we're going to do is add a bunch of body parts, so when the player hits a spike, he explodes into little pieces. To get started, we're going to open up the Artwork folder, go into our sprites, and we'll need to drag the body-part-sprites into the Resources folder. From there, let's open up the body parts and drag a single one into the scene. Now, let's attach our Random Sprite script, and we're going to name it body part sprites. From here, we're going to add a Circle Collider, and we're going to change its radius to 0.12. We also want to add the Player Bounce material to it. And now, let's add Rigidbody 2D for gravity. Now, if we run this, we'll see that the body part falls, and we get different types of body parts each time. From here, let's go into our scripts, and create a new C# script. We're going to call this BodyPart. And, we'll open this up in MonoDevelop. Now, let's add a few properties. So here, we're simply…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Creating collectable objects2m 55s
-
Randomly selecting sprites7m 18s
-
Creating a push block4m 53s
-
Creating switches5m 29s
-
Creating a door and code7m 31s
-
Creating the door trigger6m 9s
-
Connecting the obstacles together6m 39s
-
Creating gizmos3m 29s
-
Deadly obstacles3m 47s
-
Exploding the player4m 44s
-
-
-
-
-
-
-