Turning bronze coins into gold coins
You may notice that your gold coins in the scene editor show up as bronze coins in the game. This is because the Coin
class defaults to using the bronze texture and value. We will specify our gold coins by setting their name attribute to gold in the scene editor and then checking for this name in the Coin init
function. Follow these steps to implement golden coins:
- Open your encounters in the scene editor, select your gold coins, and use the Attributes inspector to set the name value of each node to
gold
, as shown here: - We can easily loop through all nodes with a certain name. We will use this functionality to ...
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.