Muutke küpsiste eelistusi

Apple Game Frameworks and Technologies: Build 2D Games with SpriteKit & Swift [Pehme köide]

  • Formaat: Paperback / softback, 500 pages, kõrgus x laius x paksus: 250x150x15 mm, kaal: 666 g
  • Ilmumisaeg: 01-Jul-2021
  • Kirjastus: The Pragmatic Programmers
  • ISBN-10: 1680507842
  • ISBN-13: 9781680507843
  • Formaat: Paperback / softback, 500 pages, kõrgus x laius x paksus: 250x150x15 mm, kaal: 666 g
  • Ilmumisaeg: 01-Jul-2021
  • Kirjastus: The Pragmatic Programmers
  • ISBN-10: 1680507842
  • ISBN-13: 9781680507843

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 xiii
    Acknowledgments xvii
    Preface xix
    Get Ready for Game Development xxv
    Part I Build Your First Game with SpriteKit
    1 Creating Scenes with Sprites and Nodes
    3(24)
    Create the Project
    3(4)
    Explore the Default Template
    7(1)
    Clean Up the Default Template
    8(2)
    Set the Supported Device Orientation
    10(3)
    Create Your First SpriteKit Scene
    13(2)
    Create Your First Sprite Node
    15(5)
    Set Position, Coordinates, and Anchor Points
    20(3)
    Add the Foreground
    23(2)
    Next Steps
    25(2)
    2 Adding Animation and Movement with Actions
    27(24)
    Animation in SpriteKit
    27(1)
    Add the Images Resources for the Player
    28(4)
    Create the Player Class
    32(2)
    Load the Textures
    34(3)
    Control Render Order with Z-Position
    37(4)
    Animate the Player with Actions
    41(1)
    Use the Animation Extension
    42(1)
    Move the Player with Actions
    43(3)
    Use Constraints to Limit Movement
    46(1)
    Set the Player's Direction Using Scales
    47(2)
    Keep the Player's Speed Consistent
    49(1)
    Next Steps
    50(1)
    3 Chaining Actions and Using Iterative Design
    51(18)
    Add Your First Collectible Item
    51(4)
    Improve Code with Iterative and Incremental Development
    55(1)
    Chain Actions Together to Create a Sequence
    56(2)
    Use Actions to Run Code Blocks
    58(3)
    Use Level Data to Add Challenging Gameplay
    61(5)
    Use Iterative Design to Adjust the Player's Movement
    66(2)
    Next Steps
    68(1)
    4 Working with Physics and Collision Detection
    69(18)
    Run a Playground Physics Simulation
    69(4)
    A Closer Look at Physics Bodies
    73(3)
    Use Physics Bodies for Collision Detection
    76(3)
    Configure Physics Categories
    79(4)
    Handle Contact Between Physics Bodies
    83(2)
    Next Steps
    85(2)
    5 Adding Labels and Working with the Game Loop
    87(26)
    Add Labels to Show Current Level and Score
    87(8)
    Use Variables to Monitor Game States
    95(10)
    Use the Game Loop to Apply Game Logic
    105(4)
    Use Attributed Strings with Labels
    109(2)
    Next Steps
    111(2)
    6 Juicing Your Games with Sound and Effects
    113(30)
    Add Sound Effects
    114(3)
    Add Background Music
    117(2)
    Build More Robust Sound Systems
    119(1)
    Create an Endless Scrolling Background
    120(5)
    Juice Your Game with Particles
    125(5)
    Handle Hit-Testing and Touch Events
    130(2)
    Squeeze Out a Little More Juice
    132(6)
    Challenge Project
    138(1)
    Next Steps
    139(4)
    Part II Use the Scene Editor to Build Games
    7 Building Scenes with the Scene Editor
    143(18)
    Create the Project
    144(1)
    Clean Up the Default Template
    145(1)
    Add the Assets
    146(1)
    Add Nodes Using the Object Library
    147(10)
    Configure the View and Load the Scene
    157(2)
    Next Steps
    159(2)
    8 Using the Scene Editor to Add Physics
    161(14)
    Write Code to Interface with the Scene
    161(3)
    Add Physics to the Player
    164(2)
    Move the Player Using Physics
    166(4)
    Connect the Attack Button
    170(3)
    Next Steps
    173(2)
    9 Operating the Camera and Using References Nodes
    175(22)
    Add a Camera to Track the Player
    176(5)
    Use Reference Nodes in Your Scene
    181(3)
    Add Support for All Devices and Orientations
    184(3)
    Resize the Player Node on Device Rotation
    187(1)
    Lock the Location of the On-Screen Controls
    188(6)
    Refactor the Code and Clean Up the Project
    194(1)
    Next Steps
    195(2)
    10 Extending Your Game World with Tile Maps
    197(30)
    Create a Bigger World with Tile Map Nodes
    198(6)
    Create a Tile Map Node
    204(2)
    Use the Tile Map Editor
    206(3)
    Add a Dungeon Tile Map
    209(5)
    Animating Tiles
    214(4)
    Configure Physics Bodies Using User Data
    218(6)
    Next Steps
    224(3)
    Part III Scale Your Games with GameplayKit
    11 Building Games with Entities and Components
    227(26)
    Organize the Project
    229(1)
    Add the Resources
    230(2)
    Create Your First Component
    232(7)
    Create Your First Entity
    239(2)
    Build a Monster Generator
    241(4)
    Animate the Monsters
    245(6)
    Next Steps
    251(2)
    12 Using States and State Machines
    253(24)
    Create the Player States
    254(2)
    Set Up the Player State Machine
    256(1)
    Add a New Collectible Component
    257(5)
    Configure the Physics Bodies
    262(5)
    Add a Physics Contact Extension
    267(4)
    Place Collectibles and Doors
    271(3)
    Add Code to Destroy Collectibles
    274(1)
    Next Steps
    274(3)
    13 Planning Routes and Creating Believable AI
    277(24)
    Modify the Monster Generator
    278(4)
    Use Agents, Goals, and Behaviors
    282(4)
    Add Agents to Monsters
    286(1)
    Add an Agent to the Player
    287(1)
    Use Multiple Goals
    288(1)
    Add the Player Agent to the Component System
    289(1)
    Add the Monster Entities to the Scene's Entities Array
    290(1)
    Update Physics for Monsters and Projectiles
    290(1)
    Build a Better Health Component
    291(2)
    Add Pathfinding to Your Game
    293(5)
    Next Steps
    298(3)
    Part IV Enhance the Player's Experience
    14 Using the Action Editor and Enhancing Gameplay
    301(24)
    Use the Action Editor to Add Actions
    301(5)
    Add the Player's Heads-Up Display
    306(2)
    Build Better On-Screen Controls
    308(15)
    Next Steps
    323(2)
    15 Adding More Scenes and Saving the Game
    325(20)
    Add New Scenes
    325(6)
    Present the Title Scene
    331(1)
    Load the First Game Scene
    332(1)
    Present the Game Over Scene
    332(2)
    Save and Load Game Data
    334(4)
    Exit the Map and Load the Next Scene
    338(2)
    Create Additional Game Scenes
    340(1)
    Support 3D Spatial Audio Effects
    341(1)
    Next Steps
    342(3)
    Part V Build Social Games with GameKit
    16 Adding Leaderboards and Achievements
    345(24)
    Add Game Center Capability Using Xcode
    346(2)
    Use App Store Connect to Add a New App
    348(3)
    Add a Leaderboard
    351(2)
    Add an Achievement
    353(2)
    Create the Game Center Helper
    355(4)
    Show the Game Center Dashboard
    359(3)
    Report Score to Leaderboard
    362(2)
    Report Achievement
    364(3)
    Next Steps
    367(2)
    17 Creating Multiplayer Games with GameKit
    369(24)
    Request a Turn-Based Match
    370(3)
    Manage Multiplayer Matches
    373(3)
    Process Player Turns Using an Event Listener
    376(1)
    Use Custom Match Data in Multiplayer Games
    377(2)
    Update the Game Scene to Send the Match Data
    379(8)
    Use Multiple Devices or Simulators for Testing
    387(3)
    Next Steps
    390(3)
    Part VI Bonus Content: Monetize Your Games
    18 Using Ads to Increase Revenue
    393(34)
    Sign up for AdMob and Register Your App
    393(3)
    Create Ad Units
    396(5)
    Download and Integrate the Google Mobile Ads SDK
    401(4)
    Add the AdMob Helper File
    405(1)
    Use the AdMob Helper for Banner Ads
    406(5)
    Add the Continue Game Feature (Player Reward)
    411(6)
    Use the AdMob Helper for Rewarded Ads
    417(3)
    Create Custom Notifications
    420(4)
    Save and Load the Number of Continues
    424(2)
    Next Steps
    426(1)
    19 Monetizing Your Games with In-App Purchases
    427(32)
    Add In-App Purchase Capability Using Xcode
    427(2)
    Use App Store Connect to Add a New App
    429(7)
    Add In-App Purchase Support to the Project
    436(1)
    Configure Products in Xcode
    437(1)
    Modify the GameData Class to Store Purchases
    438(1)
    Modify the AdMob Helper to Disable Ads
    439(1)
    Modify the GameScene Class to Handle Paid Continues
    440(4)
    Configure the Shop Scene
    444(5)
    Add the Shop Scene to the Main Game Scene
    449(2)
    Interface with StoreKit Using the Store Manager
    451(6)
    Test In-App Purchases
    457(1)
    Next Steps
    458(1)
    Index 459
    Tammy Coron is an independent creative professional and the maker behind the AdventureGameKit, a custom SpriteKit framework for building point and click adventure games. As an author, editor, illustrator, and indie game developer, Tammy spends her time creating content and teaching others. For more information about Tammy, visit her website at https: //tammycoron.com.