
Swift 3 Game Development
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
- [*] Learn the core fundamentals of SpriteKit game development and mix and match techniques to customize your game
- [*] This step-by-step practical guide will teach you to build games from scratch using little-known tips and strategies for maximum fun
Book DescriptionSwift is the perfect choice for game development. Developers are intrigued by Swift 3.0 and want to make use of new features to develop their best games yet. Packed with best practices and easy-to-use examples, this book leads you step by step through the development of your first Swift game. This book starts by introducing SpriteKit and Swift's new features that can be used for game development. After setting up your first Swift project, you will build your first custom class, learn how to draw and animate your game, and add physics simulations. Then, you will add the player character, NPCs, and powerups. To make your game more fun and engaging, you will learn how to set up scenes and backgrounds, build fun menus, and integrate with Apple Game Center to add leaderboards and achievements. You will then make your game stand out by adding animations when game objects collide, and incorporate proven techniques such as the advanced particle system and graphics. Finally, you will explore the various options available to start down the path towards monetization and publish your finished games to the App Store. By the end of this book, you will be able to create your own iOS games using Swift and SpriteKit. What you will learn - [*] Deliver powerful graphics, physics, and sound in your game by using SpriteKit
- [*] Set up the scene using the new capabilities of the scene editor and custom classes
- [*] Maximize gameplay with little-known tips and strategies for fun and repeatable action
- [*] Make use of animations, graphics, and particles to polish your game
- [*] Understand the current mobile monetization landscape to choose the best option for your own situation
- [*] Integrate your game with Game Center so that your players can share their high scores and achievements
- [*] Publish your game to the App Store and enjoy people playing your games
Who this book is forIf you wish to create and publish fun iOS games using Swift, then this book is for you. You should be familiar with basic programming concepts. However, no prior game development or Apple ecosystem experience is required.
More details
Person
Stephen Haney has written two books on iOS game development. He began his programming journey at the age of 8 years on a dusty, ancient laptop using BASIC. He has been fascinated with building software and games ever since. Now well versed in multiple languages, he enjoys programming as a creative outlet the most. He believes that indie game development is an art forman amazing combination of visual, auditory, and psychological challengesrewarding to both the player and the creator. He enjoyed writing this book and sincerely hopes that it directly furthers your career or hobby.
Content
- Cover
- Copyright
- Credits
- About the Author
- About the Reviewer
- www.PacktPub.com
- Customer Feedback
- Table of Contents
- Preface
- Chapter 1: Designing Games with Swift
- Why you will love Swift
- Prerequisites
- What you will learn in this book
- Embracing SpriteKit
- Reacting to player input
- Structuring your game code
- Building UI/menus/levels
- Integrating with Game Center
- Maximizing fun
- Crossing the finish line
- Monetizing your work
- New in Swift 3
- Setting up your development environment
- Introducing and installing Xcode
- Creating our first Swift game
- Navigating our project
- Exploring the SpriteKit demo
- Examining the demo code
- Cleaning up
- Summary
- Chapter 2: Sprites, Camera, Action!
- Sharpening our pencils
- Checkpoint 2-A
- Drawing your first sprite
- Building a SKSpriteNode class
- Adding animation to your toolkit
- Sequencing multiple animations
- Recapping your first sprite
- The story on positioning
- Alignment with anchor points
- Adding textures and game art
- Downloading the free assets
- More exceptional art
- Drawing your first textured sprite
- Adding the bee image to your project
- Loading images with SKSpriteNode
- Designing for retina
- The ideal asset approach
- Hands-on with retina in SpriteKit
- Organizing your assets
- Exploring Assets.xcassets
- Collecting art into texture atlases
- Updating our bee node to use the texture atlas
- Iterating through texture atlas frames
- Putting it all together
- Centering the camera on a sprite
- Checkpoint 2-B
- Summary
- Chapter 3: Mix in the Physics
- Laying the foundation
- Following protocol
- Reinventing the bee
- The icy tundra
- Adding the ground texture to Assets.xcassets
- Adding the Ground class
- Tiling a texture
- Running wire to the ground
- A wild penguin appears!
- Renovating the GameScene class
- Exploring the physics system
- Dropping like flies
- Solidifying the ground
- Checkpoint 3-A
- Exploring physics simulation mechanics
- Bee meets bee
- Impulse or force?
- Checkpoint 3-B
- Summary
- Chapter 4: Adding Controls
- Retrofitting the Player class for flight
- The Beekeeper
- Updating the Player class
- Moving the ground
- Assigning a physics body to the player
- Creating a physics body shape from a texture
- Polling for device movement with Core Motion
- Implementing the Core Motion code
- Checkpoint 4-A
- Wiring up the sprite onTap events
- Implementing touchesBegan in the GameScene
- Larger than life
- Teaching our penguin to fly
- Listening for touches in GameScene
- Fine-tuning gravity
- Spreading your wings
- Improving the camera
- Pushing Pierre forward
- Tracking the player's progress
- Looping the ground
- Checkpoint 4-B
- Summary
- Chapter 5: Spawning Enemies, Coins, and Power-ups
- Introducing the cast
- Locating and adding the art assets
- Adding the Power-up Star
- Adding the Star class
- Adding a new enemy - the Mad Fly
- Adding the MadFly class
- Another terror - Bats!
- Adding the Bat class
- Guarding the ground - adding the Blade
- Adding the Blade class
- Adding the coins
- Creating the coin classes
- Organizing the project navigator
- Testing the new game objects
- Checkpoint 5-A
- Preparing for endless flight
- Summary
- Chapter 6: Generating a Never-Ending World
- Designing levels with the SpriteKit scene editor
- Separating level data from game logic
- Using custom classes in the scene editor
- Encounters in endless flying
- Creating our first encounter
- Integrating scenes into the game
- Checkpoint 6-A
- Spawning endless encounters
- Building more encounters
- Updating the EncounterManager class
- Storing metadata in SKSpriteNodeuserData property
- Wiring up EncounterManager in the GameScene class
- Spawning the Power-up Star at random
- Turning bronze coins to gold
- Checkpoint 6-B
- Summary
- Chapter 7: Implementing Collision Events
- Learning the SpriteKit collision vocabulary
- Collision versus contact
- Physics category masks
- Using category masks in Swift
- Adding contact events to our game
- Setting up the physics categories
- Assigning categories to game objects
- The player
- The ground
- The Power-up Star
- Enemies
- Coins
- Preparing GameScene for contact events
- Viewing console output
- Testing our contact code
- Checkpoint 7-A
- Player health and damage
- Animations for damage and game over
- The damage animation
- The game over animation
- Collecting coins
- The Power-up Star logicterrific progress in this chapter. To download my project up to this
- Checkpoint 7-B
- Summary
- Chapter 8: Polishing to a Shine - HUD, Parallax Backgrounds, Particles, and More
- Adding a HUD
- Implementing the HUD
- Parallax background layers
- Adding the background assets
- Implementing a background class
- Wiring up backgrounds in the GameScene class
- Checkpoint 8-A
- Harnessing SpriteKit's particle system
- Adding the circle particle asset
- Creating a SpriteKit particle file
- Configuring the path particle settings
- Adding the particle emitter to the game
- Granting safety as the game starts
- Checkpoint 8-B
- Summary
- Chapter 9: Adding Menus and Sounds
- Building the main menu
- Creating the menu scene and menu nodes
- Launching the main menu when the game starts
- Wiring up the START GAME button
- Adding the restart game menu
- Extending the HUD
- Wiring up GameScene for game over
- Informing the GameScene class when the player dies
- Implementing touch events for the restart menu
- Checkpoint 9-A
- Adding music and sound
- Adding the sound assets to the game
- Playing background music
- Playing sound effects
- Adding the coin sound effect to the Coin class
- Adding the power-up and hurt sound effects to the Player class
- Playing a sound when the game starts
- Checkpoint 9-B
- Summary
- Chapter 10: Standing Out in the Crowd with Advanced Features
- Adding fun crates to smash open
- Creating the Crate particle effects
- Recycling emitter nodes with particle pools
- Checkpoint 10-A
- Wiring up crate contact events
- Adding a health crate
- Smashing coin crates
- Checkpoint 10-B
- Summary
- Chapter 11: Choosing a Monetization Strategy
- Developing your marketing plan
- When to start marketing
- Marketing checklist
- Leveraging crowdfunding
- Pros and cons of crowdfunding
- Showing display ads for revenue
- The upsides to showing ads
- The downsides to showing ads
- Selling in-app purchases
- In-app purchase strategies
- A word about farming your players
- Localization into foreign markets
- Managing scope and completing projects
- Summary
- Chapter 12: Integrating with Game Center
- Registering an app with iTunes Connect
- Creating a test user
- Authenticating the player's Game Center account
- Opening Game Center in our game
- Checkpoint 10-A
- Adding a leaderboard of high scores
- Creating a new leaderboard in iTunes Connect
- Updating the leaderboard from the code
- Adding an achievement
- Creating a new achievement in iTunes Connect
- Updating achievements from the code
- Checkpoint 10-B
- Summary
- Chapter 13: Ship It! Preparing for the App Store and Publication
- Finalizing assets
- Adding app icons
- Designing the launch screen
- Taking screenshots for each supported device
- Finalizing iTunes Connect information
- Configuring pricing
- Uploading our project from Xcode
- Submitting for review in iTunes Connect
- Summary
- Index
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.