Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
iOS Game Programming Cookbook

You're reading from   iOS Game Programming Cookbook Over 45 interesting game recipes that will help you create your next enthralling game

Arrow left icon
Product type Paperback
Published in Mar 2015
Publisher
ISBN-13 9781784398255
Length 300 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (14) Chapters Close

Preface 1. iOS Game Development FREE CHAPTER 2. SpriteKit 3. Animations and Texture 4. Particle System and Game Performance 5. Adding Music to iOS Games and an Introduction to iCloud 6. Physics Simulation 7. Adding Reality to Games 8. Introduction to Game Math and Physics 9. Autonomous Moving Agents 10. 3D Game Programming with OpenGL 11. Getting Started with Multiplayer Games 12. Implementing Multiplayer Games Index

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 on other device by sending and receiving network packets.

How to do it

Following are the steps involved in making a tank move on touch and also sync on a remote device by sending and receiving packets:

  1. On touching the screen, these methods of...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image