Wednesday, May 28, 2014

HowTo organize your Objective code with the '#pragma mark' directive

Welcome to Part 9 of my blog series about game development.

Todays post is very short. I'll only show how the '#pragma mark' directive can help you to organize your code. The navigation bar on top of the code window provides the possibility to navigate in your code. Just click on the last entry:

This will open a drop down list of all available constants, properties and methods. By selecting one element in the list, the code windows scrolls to the corresponding code section. So far so good, but  the methods are listed in alphabetical order. This becomes quite messy if the code for your class is growing.

Thursday, May 22, 2014

HowTo: Implement a HUD in SpriteKit

Welcome to Part 8 of my blog series about game development.

Today I'll add a HUD (head up display) to the SpriteKit Scene. The HUD shows the remaining lives, current, level, score and has the option to pause the game:

Create the HUD:

1. Create a new SpritKit project in Xcode:

Monday, May 5, 2014

HowTo: Extend endless horizontal scrolling with a vertical parallax effect

Welcome to Part 7 of my blog series about game development.

Today I'll extend the parallax effect from part 5 of my posts with vertical scrolling. This should increase the illusion of depth. To control the movement I'll use the motion sensors as described in part 6.

Steps to achieve this behavior:

  • Scale the width and the height of the background image and implement horizontal and vertical movement of the background image: