Game Development Reference
In-Depth Information
Engage thrusters
Here, we will create the object's
Key
and
Door
object first, and then we will create the
Re-
startButton
using
GUITexture
. Let's do this as follows:
1. Let's go to
SimplePlatform
|
Resources
|
Sprites
|
Level
in the
Project
view and
drag the
Key
object to the
Hierarchy
view. At the
Hierarchy
view, we will click
on the
Key
game object and then go to
Component
|
Physics 2D
|
Circle Collider
2D
to add the
Circle Collider 2D
component. Next, we will go to its
Inspector
view, and set it as follows:
Tag
Key
Transform
Position
X
:
10
,
Y
:
-2
, and
Z
:
0
Scale
X
:
0.7
,
Y
:
0.7
, and
Z
:
1
Sprite Renderer
Color
R
:
255
,
G
:
142
,
B
:
0
, and
A
:
255
Circle Collider 2D
Is Trigger
Check the box
2. Next, we click on the
Key
game object in the
Hierarchy
view and drag inside
SimplePlatform
|
Resources
|
Prefabs
in the
Project
view to create the
Key
pre-
fab object.
3. Then, we will create the
Door
game object by going to
SimplePlatform
|
Re-
sources
|
Sprites
|
Level
in the
Project
view and dragging the
DoorClose
object to
the
Hierarchy
view. At the
Hierarchy
view, we will click on the
DoorClose
game
object, go to
Component
|
Physics 2D
|
Box Collider 2D
, and then go to
Com-
ponent
|
Miscellaneous
|
Animator
.
4. Next, we will click on the
DoorClose
game object, rename it to
Door
, and go to
Inspector
, and set it as follows:
Tag
Door