Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
iOS Game Development By Example

You're reading from   iOS Game Development By Example Learn how to develop an ace game for your iOS device, using Sprite Kit

Arrow left icon
Product type Paperback
Published in Aug 2015
Publisher Packt
ISBN-13 9781785284694
Length 220 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Samanyu Chopra Samanyu Chopra
Author Profile Icon Samanyu Chopra
Samanyu Chopra
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. An Introduction to Sprite Kit FREE CHAPTER 2. Scenes in Sprite Kit 3. Sprites 4. Nodes in Sprite Kit 5. Physics in Sprite Kit 6. Animating Sprites, Controls, and SceneKit 7. Particle Effects and Shaders 8. Handling Multiple Scenes and Levels 9. Performance Enhancement and Extras 10. Revisiting Our Game and More on iOS 9 Index

Coordinate system


Everything in a game built in Sprite Kit is related to nodes, and it follows a node tree structure where a scene is a root node and other nodes are child nodes of it. When we put a node in the node tree, it uses its position property to place it within the coordinate system provided by its parent.

As a scene is also a node, it is placed inside the view provided by the SKView object. The code part which we deleted in viewDidLoad, GameScene, was added as a child in the SKView object. A scene uses its parent SKView object coordination system to render itself and the content within it. The coordinate system is the same as we learned in basic mathematics.

As the preceding diagram shows, if we move right from (0,0), then x will be positive, and negative if we move left from (0,0). If we move up from (0,0), then y will be positive, and negative if we move down from (0,0). Coordinate values are measured in points and when the scene is rendered, it will be converted to pixels.

All...

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 €18.99/month. Cancel anytime