O'Reilly logo

iOS Game Programming Cookbook by Bhanu Birani, Chhavi Vaishnav

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing game play

It is now time to implement the game play in which, how the players (tanks) are going to win or lose in the game called TankRace will be determined. The game play is that, whichever player first reaches the finish line on their opposite side, of the same color as their own, wins the race and other loses.

Getting ready

Before we begin, we must know how to detect collision from sprites in the SpriteKit and a little about playing with the labels of SpriteKit. In this section, we will be implementing the game play and also show an alert when there is no connection between the devices.

How to do it

Following are the steps involved for implementing the game play and deciding who wins or loses:

  1. We will be detecting the collision in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required