Smashing coin crates
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:
In Xcode, open one of the encounter scenes we created earlier in this book. I am using
EncounterA.sks
for this example. The scene will open in the Scene Editor. In the lower right, click on the Media Library to see the media assets in your project.Locate the crate texture and drag it into your encounter.
In the upper right, click on the Custom Class Inspector and assign a Custom Class of
Crate
, as illustrated in the following screenshot:Repeat the process to create as many crates as you like. You can place them slightly above the ground and gravity will settle them into place.
Tip
You can always hold option and drag an existing sprite to create a clone with the same properties (persisting the Custom Class setting).
That is all you need to do to add smashable crates to the game. You can repeat this in all of your encounters...