Chapter 3. Expandable Item Classes
Items in video games are very important. They can be tools, weapons, healing items, traps, clothing, armor, ammo, keys, and so on. Items are what the player will interact with the most in your game. Since the items are so often used, it is a good practice to create item classes that can be expanded and used in all possible situations without having to rewrite the class.
In this chapter, we will cover the following topics:
- Creating customizable classes for items
- Learning how GameObjects can interact with each other through sending messages
- Creating an
Itemclass that affects the player - Creating a
Meleeitem class that will affect environments and enemies - Creating a
Projectileitem class that can be used for items that travel distances - Utilizing a classification system for all objects to decide what they do
- Using trigger-based collisions for the
MeleeandProjectileitem classes - Using two types of movement for projectile items