Game Development Reference
In-Depth Information
It Lives!
You've got a working game. You've got a character running around. OK, so that was
cool while it lasted, but now you want to see more and do more. You've come to
the right place because this is your first "Quest". Yes, quest. You're now on a quest.
I suggest that you find a good chalice and a horse or, at the least, a very capable pony.
In this first quest, appropriately named "Quest 1," we will be taking our snazzy little
back and forth walking game and giving it some pizzazz.
Cameras - they now stalk us!
It's one thing for the camera to see what we're doing, but it's another thing entirely
for that camera to follow the player. Almost like a hungry stalker, that camera
should always know what the player is doing and where they are doing it. It should
also take a video of the player at all times to salivate over later, like a stalker. So, let's
make that happen.
We're going to do this by creating a new script component for the camera which will
be able to listen to the player's state changes. This is just one way of handling camera
movements; however, for the scope of this topic, it will be helpful for you if we see
the power of using events and delegates , and learn a bit more about why exactly
we love state machines .
Oh sorry! What is a state machine? Wikipedia offers a pretty nice description.
However, in quick terms, a state machine (in the context of programming) is a piece
of code that performs separate actions based on the current state of an object. For
example, a cat has three states—awake, sleeping, and trying to take over the world.
The cat's state machine would perform different actions depending on which state
the cat is currently in.
Search WWH ::




Custom Search