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

Movement of players

Once the environment for multiplayer is ready, it's time for the actual action: making the player move when a user touches or drags on screen. As it's a multiplayer game the movement is to be synced with the remote device, which a good challenge and a magical thing to experience.

Getting ready

Before starting with this section we should be aware of the touch methods of SKScene like touchBegan, touchMoved, and touchEnded as all the movement will be done on the basis on touch. Also we should be good at mathematics, as this movement of tanks with its head to be in the direction of touch, has to be done and synced with the remote device. In this section, we will be implementing the movement of tanks and also syncing the movement ...

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