Game Development Reference
In-Depth Information
• Copy the scripts from this chapter (
Delegates
,
Events
,
Coroutines
,
ScriptingObject
) to the
Examples
folder, or just delete them as they are
not for the game itself. If you didn't create them, just ignore this step.
• Move the
Messaging
scripts to the
Messaging
folder, and likewise, the
Navigation
scripts to the
Navigation
folder.
Starting with Greybeard, add him on the left-hand side of the scene, next to the cave. This
is because in the next section, he is going to stop our hero from entering the cave, as it is
just too dangerous for such an impetuous youth.
To do this (using the lessons we have learned already), perform the following steps:
1. Create a new game object and name it
Greybeard
.
2. If you haven't done so already, import the
04.png
character spritesheet and use
Sprite Editor
to slice it up.
3. Give it a
Sprite Renderer
component using the
04_3
sprite from the
04
wizard's
spritesheet.
4. Create an idle animation for Greybeard using the
04_03
and
04_06
sprites so it
appears that Greybeard is fidgeting (optional); then, add it to a new
Animator
component and add that to the Greybeard's game object.
5. Finally, add a
Box Collider 2D
component with the settings shown in the follow-
ing screenshot. This is so that the collider is of the same width as that of Grey-
beard himself but with a larger height so that the player can collide with it. Also,
set the
Is Trigger
property to true/checked.
The final result should look something like the following screenshot: