Find online courses made by experts from around the world.
Take your courses with you and learn anywhere, anytime.
Learn and practice real-world skills and achieve your goals.
***SOURCE PROJECT FILES UPDATED FOR SWIFT 3 (see change notes below)
In the first section of videos, you'll learn how to find connected controllers, define which buttons do what, set player indexes (i.e. Player 1, Player 2, etc) and work with a basic character.
In section 2, you'll learn the Swift / Sprite Kit code to work with multiple Extended / Standard Gamepad controllers (as well as the Micro Gamepad controller), to go head to head versus players in the same room. After we look at the finer points of connecting and disconnecting controllers and getting each in the right player slot, we'll discuss how to control who is who in any type game, and even go into a one-player mode where the CPU takes control of the second player. This way your two-player game can also be enjoyed by single players. We'll also discuss adding a Pause menu to your game, where players can go back to a Main menu or keep on playing.
Now that we've covered all our bases in terms of controlling each player and dealing with controllers disconnecting and reconnecting, section 3 allows us to have some fun. This session we'll loosen things up a bit and just talk game play. Topics include collision detection, decrementing health, losing lives / restarting rounds, and other topics worthy of a good two-player game!
***CHANGE NOTES FROM SWIFT 2 to 3
We've included updated source files for Swift 3. If you choose to follow along, line-by-line with the video code, you should have no problems, as Xcode 8 will auto-suggest the correct code for Swift 3.
Not for you? No problem.
30 day money back guarantee.
Learn on the go.
Desktop, iOS and Android.
Certificate of completion.
|Section 1: Swift Programming for External Controllers on tvOS|
Connecting an Extended GamePad ControllerPreview
Connecting Standard and Micro Gamepad (the remote) Controllers
Project files for Swift 3 / Swift 2.2
Moving Player 1 with the Extended or Micro Gamepad
Rotating with the Extended and MicroGamePad
Wrapping up One-Player Controls with Firing
Project Files 2
|Section 2: Player vs Player with Multiple Controllers|
Handling Multiple Controllers with tvOS
Project (Before Second Player Added)
Setting up the Second Player (and Creating a Custom Tank Class)
Setting up the Second Player (continued)
Firing from the Second Player
Adding a One-Player Mode with CPU Controlled Second Player
Going Back and Forth Between 1-Player and 2-Player Modes
Going Back and Forth Between 1-Player and 2-Player Modes (continued)
Pause Screens with Options to Resume or go to the Main Menu
Adding a Main Menu
|Section 3: Player vs Player Gameplay|
Detecting Physics Collisions
Creating a Bullet Class
Animated Explosions and Tank with Tank Bumping
Tank with Bullet Collisions and Losing Lives
Loading New Levels and Adding a Lives Label
Making the Camera Track a Central Point Between Players
Adding Walls to Ricochet or Remove Bullets
Justin Dike is the founder of CartoonSmart one of the internet's first video training websites. He is a long-time illustrator and animator, focusing mostly on Adobe Flash, and experienced programmer with Swift, Sprite Kit, Actionscript 3, Objective C and Cocos2d. For CartoonSmart he has recorded hundreds of hours of video tutorials and recently published his first full length book titled iOS Programming with Xcode and Cocos2d available in the iBookstore. Justin has also developed many iOS games, including a side scrolling game engine.