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:







Monday, April 7, 2014

HowTo: Use the Device Motion Sensors to control your game


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


Today I'll include motion detection to control the movement of my game. iOS offers a powerful API to handle motion detection with the CMMotionManager class.

Let's start with a small standalone project to show how to use the motion detection:

Friday, March 28, 2014

HowTo: Implement endless scrolling with parallax effects

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

Today I'll create a component which implements the endless scrolling and adds some parallax effects. I'll use SpriteKit for that. A nice tutorial about SpriteKit can be found here and here and here.

If you haven't completed part 3 or 4, you can download the project from GitHub: v0.3

First of all we need some background images to show the infinite parallax scrolling. I've created four layers:

Background:





Tuesday, March 18, 2014

HowTo: Implement endless scrolling


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

Today I'm showing how to implement an endless scrolling which is typical for Jump & Run games. 




First of all you need a background with 3 sections like the one shown below:



Section 1 and 3 must be identical and have to fit on the whole screen. 


Tuesday, March 4, 2014

HowTo: Add Splash Screen & Application Icons

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

Today I'm adding the app icons and a splash screen. I'll use an asset catalog for that. If you haven't completed part 2, you can download the project from GitHub: v0.2.1

First of all let's hide the annoying header bar:




You have to add to entries in the plist file: "Supporting Files/MyFirstGame-Info.plist"