Add a New Collectible Component
You first learned about components in Create Your First Component. With components, the focus is on what a “thing” does versus what it is. You might believe that this focus lets you off the hook for thinking about what things are, but that isn’t the case; you still need to consider how you’ll be using your components.
In Val’s Revenge, there are three kinds of collectible items (types):
Each type serves a useful purpose:
- Key: Collect keys to unlock dungeon doors
- Food: Collect food to increase Val’s health (up to her maximum)
- Treasure: Collect treasure for bragging rights
Similar to what you did in Creating an Animation ...
Get Apple Game Frameworks and Technologies now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.