Build Better On-Screen Controls
Apple Game Frameworks and Technologies — by Tammy Coron (137 / 193)
👈 Add the Player’s Heads-Up Display | TOC | Next Steps 👉
In Chapter 8, Using the Scene Editor to Add Physics, you created a simple 8-way D-pad controller and an Attack button. While those controls work okay (except for the z-position problem, where newly spawned monsters show up on top of the controls), you’re about to make them much better by giving the player the ability to move and fire with a full 360° of rotation.
Prepping for the New Controls
In the Project Navigator, select the GameScene.sks file to open it up in the Scene Editor.
From the Scene Graph View, select and delete both the controller and the attackButton reference nodes.
To keep your project free of clutter, remove the two corresponding SKS files: Controller.sks and AttackButton.sks. When prompted, move both of these files to the trash.
The next step is to add the resources for the new controls.
Adding and Updating Controller Resources
Back in the Project Navigator, select the Assets.xcassets asset catalog, and in the controller sprite atlas, find and delete the button_attack and controller_stop image sets. Again, you want to keep your project free of unnecessary clutter. You won’t be using these resources, so there’s no need…