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

Adding infinite scrolling

Now we are all ready with our spaceship. It's time to add some more in the game. So our next target is to add infinite scrolling to the game, so that we can make our spaceship move infinitely in space. In this recipe, we will be learning about the ways to add infinite scrolling to games.

Getting ready

For an infinite scrolling background you need to know about the anatomy of SpriteKit shown earlier. You should be aware of the rendering loop, how in a particular frame the update method functions, and how SKScene evaluates the actions and physics simulation thereby rendering all the stuff in the SKView. Now using this loop, you implement sky scrolling infinitely giving the feel of a spaceship flying.

How to do it...

Now is the time for action; perform the following steps to add the infinite scrolling background to your game.

  1. Import the SpaceBackground.png file provided in the Resources folder.
  2. Add a function in FSMyScene for initializing the infinite background.
  3. In...
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