Apple Game Frameworks and Technologies: Build 2D Games with SpriteKit & Swift
Design and develop sophisticated 2D games that are as much fun to make as they are to play. From particle effects and pathfinding to social integration and monetization, this complete tour of Apple’s powerful suite of game technologies covers it all. Familiar with Swift but new to game development? No problem. Start with the basics and then layer in the complexity as you work your way through three exciting – and fully playable – games. In the end, you’ll know everything you need to go off and create your own video game masterpiece for any Apple platform.
Discover the power of Apple Game Frameworks, Xcode, and Swift by building three exciting games: Gloop Drop – a new twist on a classic arcade game, Val’s Revenge – a roguelike dungeon crawler, and Hog – a social player vs. player mobile dice game. With Apple Game Frameworks, you can create high-performance, power-efficient games that work across all Apple platforms, including iOS, macOS, tvOS, and watchOS.
In this book, you’ll discover how to…
Design and develop rich 2D gaming experiences using Apple’s built-in game frameworks. Harness the power of SpriteKit using Xcode and Swift to create engaging player experiences. Use the visual Scene Editor to build complete scenes. Unleash the power of the Particle Editor to create amazing effects. Use GameplayKit to add advanced features to your games like pathfinding, artificial intelligence, and complex rule systems. Build larger, more complex worlds with tile maps and Xcode’s visual Tile Map editor. Bring people together using GameKit and Game Center, Apple’s social gaming network. Increase revenue with third-party banner ads and rewarded ads using Google AdMob ™. Monetize your games with StoreKit and in-app purchases.
So, grab your gear and get your game on – it’s time to level up your skills.
What You Need:
- macOS Mojave 10.14.6 or newer
- Xcode 11.3 or newer
- Basic knowledge of Swift 5.1.4 or newer
Foreword Acknowledgments Preface Who Should Read This Book What Are Apple Game Frameworks and Technologies What’s in This Book What’s Not in This Book How to Read This Book Conventions Used in This book Online Resources Next Steps Get Ready for Game Development Discover Your Idea Make a Plan Gather Your Resources Next Steps Part I. Build Your First Game with SpriteKit 1. Creating Scenes with Sprites and Nodes Create the Project Explore the Default Template Clean Up the Default Template Set the Supported Device Orientation Create Your First SpriteKit Scene Create Your First Sprite Node Set Position, Coordinates, and Anchor Points Add the Foreground Next Steps 2. Adding Animation and Movement with Actions Animation in SpriteKit Add the Images Resources for the Player Create the Player Class Load the Textures Control Render Order with Z-Position Animate the Player with Actions Use the Animation Extension Move the Player with Actions Use Constraints to Limit Movement Set the Player’s Direction Using Scales Keep the Player’s Speed Consistent Next Steps 3. Chaining Actions and Using Iterative Design Add Your First Collectible Item Improve Code with Iterative and Incremental Development Chain Actions Together to Create a Sequence Use Actions to Run Code Blocks Use Level Data to Add Challenging Gameplay Use Iterative Design to Adjust the Player’s Movement Next Steps 4. Working with Physics and Collision Detection Run a Playground Physics Simulation A Closer Look at Physics Bodies Use Physics Bodies for Collision Detection Configure Physics Categories Handle Contact Between Physics Bodies Next Steps 5. Adding Labels and Working with the Game Loop Add Labels to Show Current Level and Score Use Variables to Monitor Game States Use the Game Loop to Apply Game Logic Use Attributed Strings with Labels Next Steps 6. Juicing Your Games with Sound and Effects Add Sound Effects Add Background Music Build More Robust Sound Systems Create an Endless Scrolling Background Juice Your Game with Particles Handle Hit-Testing and Touch Events Squeeze Out a Little More Juice Challenge Project Next Steps Part II. Use the Scene Editor to Build Games 7. Building Scenes with the Scene Editor Create the Project Clean Up the Default Template Add the Assets Add Nodes Using the Object Library Configure the View and Load the Scene Next Steps 8. Using the Scene Editor to Add Physics Write Code to Interface with the Scene Add Physics to the Player Move the Player Using Physics Connect the Attack Button Next Steps 9. Operating the Camera and Using References Nodes Add a Camera to Track the Player Use Reference Nodes in Your Scene Add Support for All Devices and Orientations Resize the Player Node on Device Rotation Lock the Location of the On-Screen Controls Refactor the Code and Clean Up the Project Next Steps 10. Extending Your Game World with Tile Maps Create a Bigger World with Tile Map Nodes Create a Tile Map Node Use the Tile Map Editor Add a Dungeon Tile Map Animating Tiles Configure Physics Bodies Using User Data Next Steps Part III. Scale Your Games with GameplayKit 11. Building Games with Entities and Components Organize the Project Add the Resources Create Your First Component Create Your First Entity Build a Monster Generator Animate the Monsters Next Steps 12. Using States and State Machines Create the Player States Set Up the Player State Machine Add a New Collectible Component Configure the Physics Bodies Add a Physics Contact Extension Place Collectibles and Doors Add Code to Destroy Collectibles Next Steps 13. Planning Routes and Creating Believable AI Modify the Monster Generator Use Agents, Goals, and Behaviors Add Agents to Monsters Add an Agent to the Player Use Multiple Goals Add the Player Agent to the Component System Add the Monster Entities to the Scene’s Entities Array Update Physics for Monsters and Projectiles Build a Better Health Component Add Pathfinding to Your Game Next Steps Part IV. Enhance the Player’s Experience 14. Using the Action Editor and Enhancing Gameplay Use the Action Editor to Add Actions Add the Player’s Heads-Up Display Build Better On-Screen Controls Next Steps 15. Adding More Scenes and Saving the Game Add New Scenes Present the Title Scene Load the First Game Scene Present the Game Over Scene Save and Load Game Data Exit the Map and Load the Next Scene Create Additional Game Scenes Support 3D Spatial Audio Effects Next Steps Part V. Build Social Games with GameKit 16. Adding Leaderboards and Achievements Add Game Center Capability Using Xcode Use App Store Connect to Add a New App Add a Leaderboard Add an Achievement Create the Game Center Helper Show the Game Center Dashboard Report Score to Leaderboard Report Achievement Next Steps 17. Creating Multiplayer Games with GameKit Request a Turn-Based Match Manage Multiplayer Matches Process Player Turns Using an Event Listener Use Custom Match Data in Multiplayer Games Update the Game Scene to Send the Match Data Use Multiple Devices or Simulators for Testing Next Steps Part VI. Bonus Content: Monetize Your Games 18. Using Ads to Increase Revenue Sign up for AdMob and Register Your App Create Ad Units Download and Integrate the Google Mobile Ads SDK Add the AdMob Helper File Use the AdMob Helper for Banner Ads Add the Continue Game Feature (Player Reward) Use the AdMob Helper for Rewarded Ads Create Custom Notifications Save and Load the Number of Continues Next Steps 19. Monetizing Your Games with In-App Purchases Add In-App Purchase Capability Using Xcode Use App Store Connect to Add a New App Add In-App Purchase Support to the Project Configure Products in Xcode Modify the GameData Class to Store Purchases Modify the AdMob Helper to Disable Ads Modify the GameScene Class to Handle Paid Continues Configure the Shop Scene Add the Shop Scene to the Main Game Scene Interface with StoreKit Using the Store Manager Test In-App Purchases Next Steps
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.