Game Development Reference
In-Depth Information
3.2 Collectables
Many computer games depend on spreading collectable items around game world to
motivate the player to explore the world or involve in some challenges to get rewards. For
example, player can collect coins that can later be used to buy virtual tools or learn new
abilities like in many RPG games. In this section we learn how to make such collectables.
Collectables share a common behavior, which is obviously the ability to be collected when
someone touches them. This someone is not necessarily the character of the player, since it
can also be a non- player character (NPC). Therefore, we are going to make a script that
marks collectables , and another script that marks collectors . When any collector hits any
collectable, a collection attempt is triggered. This attempt can either succeed or fail depend-
ing on many factors as we are going to see. In this section I am going to create a ball that
represents the player, and this ball moves and rolls along x and z axes. The camera looks
at the ball from above, and follows ball movement on x and z axes. The ball is able to col-
lect coins, and has an inventory box to store the collected coins. Additionally, there are two
types of food this ball can collect, and each type increases the size of the ball by a specific
amount for limited time. To begin, create a ball with scale (1, 1, 1) to represent the player,
and a ground plane with scale (10, 1, 10). I assign a glass texture to the ball and a wood
ground texture to the ground like in Illustration
34. Let's also position the camera over the ball with a height of 15, and rotate it to look
downwards to be able to see the ball.
Search WWH ::




Custom Search