Place Collectibles and Doors

Apple Game Frameworks and Technologies — by Tammy Coron (118 / 193)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Add a Physics Contact Extension | TOC | Add Code to Destroy Collectibles 👉

Switch to the GameScene.sks file to open it in the Scene Editor. Once there, add three new sprite nodes with the following settings.

First, start with the key:

images/UsingStatesAndStateMachines/key-wide.png

Next, add some food:

images/UsingStatesAndStateMachines/food-wide.png

Finally, give Val some treasure:

images/UsingStatesAndStateMachines/treasure-wide.png

With the items in place, you’re ready to add some doors — three, actually — so drag three more sprite nodes into the scene. Set them up, like so:

images/UsingStatesAndStateMachines/door-wide.png

When you’re done, your scene will look something like the image.

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.