Follow along at https://www.hackingwithswift.com/100/63.
This day covers the second and final part of
Project 17: Space Race
in Hacking with Swift.I previously created projects alongside Hacking with Swift in a separate repository, and you can find Project 17 here. Even better, though, I copied it over to Day 62's folder so I could extend it for 100 Days of Swift.
With that in mind, Day 63 focuses on extending the project with a set of challenges.
Stop the player from cheating by lifting their finger and tapping elsewhere – try implementing
touchesEnded()
to make it work.
- 🔗 Commit
Make the timer start at one second, but then, after 20 enemies have been made, subtract 0.1 seconds from it so it’s triggered every 0.9 seconds. After making 20 more, subtract another 0.1, and so on. Note: you should call
invalidate()
ongameTimer
before giving it a new value, otherwise you end up with multiple timers.
- 🔗 Commit
Stop creating space debris after the player has died.