Graphic icons are an effective way to inform the player that they are carrying an item. In this recipe, if no star is being carried, a gray-filled icon in a blocked-off circle will be displayed in the top-left corner of the screen:
Then, once a star has been picked up, a yellow-filled star icon will be displayed. In many cases, icons are clearer (they don't require reading and thinking about) and can also be smaller onscreen than text messages that indicate player status and inventory items.
This recipe will also illustrate the benefits of the MVC design pattern, which we described in the previous recipe – we are changing how to communicate with the user (using the View via icons rather than text), but we can use, with no changes required, the PlayerInventory script class (the Model-Controller), which detects player-star collisions...