Spawning smashable crates that reward coins

To add smashable coin crates, we will create new crate sprites in our encounters using the scene editor. Follow these steps to add a Crate to the game:

  1. In Xcode, open one of the encounter scenes we created earlier in the book. I am using EncounterA.sks for this example. The scene will open in the Scene Editor. In the lower-right corner, click on the Media Library to see the media assets in your project.
  2. Locate the crate texture and drag it into your encounter.
  3. In the upper-right corner, click on the Custom Class Inspector and assign a Custom Class of Crate, as illustrated in the following screenshot:
    Spawning smashable crates that reward coins
  4. Repeat ...

Get Swift Game Development - Third Edition 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.