Building An iOS Game on iPad With Swift Playgrounds | Adding the Mystery Button

Published: 04 February 2023
on channel: JohnDav
1,007
16

Join My Free Newsletter: https://www.johndav.com

In part 4 of my Swift Playgrounds game development journey I'm adding the mystery button from the last video. What does it do? Well, right now it's going to add a shield effect to the player's rocket to protect it against potential hazards in the game.

New here? Start at Part 1: Building a Game on an iPad with Swift Playgrounds | Rockets are Fun
   • Building a Game on an iPad with Swift...  

0:00 - Adding the Structure between GameScene and ContentView
1:57 - Creating the data in GameScene to pass to ContentView
7:06 - Connect everything to ContentView to display it to the player.

However, I'm thinking that it might be interchangeable. Or upgradable down the road. So if you have some other ideas for what this button might do leave a comment below and let me know.

Implementing this button is not all that different than the attack button. We're going to use a Bool and pass that status through our GameData class in order to know which state we're in. Either we have shieldOn or we don't.

We're also going to need to keep track of the cooldown timer on our button so that we can't just spam it over and over again indefinitely.

Once the structure is in place it's just a matter of writing the data we need in GameScene to the Bindings and then reading that data from our ContentView in SwiftUI.

If you're enjoying this series please consider sharing it within your social networks, on Reddit or Twitter, or anywhere you think people might find it helpful.

#swiftui #spritekit #swiftplaygrounds #gamedev

//Published Games
ZER0ED: https://apps.apple.com/us/app/zer0ed/...
Shapes&Numbers: https://apps.apple.com/us/app/shapes-...


Watch video Building An iOS Game on iPad With Swift Playgrounds | Adding the Mystery Button online without registration, duration hours minute second in high quality. This video was added by user JohnDav 04 February 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,007 once and liked it 16 people.