Tuesday, October 21, 2014

Writing games is more fun than writing a blog post: New teaser video for my upcoming tutorial

Sorry, I love writing blog posts, but this time I have written a small game instead of completing my tutorial. Here's another short teaser video:




That's all for today. The complete code will be available at GitHub soon.

Cheers,
Stefan

Wednesday, October 8, 2014

Kick off for my new Tutorial: How to implement a space shooter with SpriteKit and SWIFT

I'm preparing a new tutorial: 

My goal is to implement a complete space shooter with SpriteKit and SWIFT.

Planned content is:

  • Part 1: Initial project setup, sprite creation and movement using SKAction and SKConstraint
  • Part 2: Adding enemies, bullets and shooting with SKAction and SKConstraint
  • Part 3: Adding a HUD with SKLabelNode and SKSpriteNode
  • Part 4: Adding basic game logic and collision detection
  • Part 5: Adding particles and sound 
  • Part 6: GameCenter integration

Here's a short teaser video:


The sample code will be available on GitHub



That's all for today.

Cheers,
Stefan

Monday, September 22, 2014

HowTo: Implement targeting or follow behavior for sprites with SpriteKit and SKConstraint in SWIFT

Welcome to Part 14 of my blog series about iOS game development.

At the developer conference WWDC, in June this year, Apple showed a new class in SpriteKit: SKConstraint. It can be used to define constraints for the orientation, the distance or the position of SpriteKit nodes. In my todays blog post I'll show how to use SKContraints to implement a follow and targeting behavior. I have updated this tutorial to XCode 6.1!






Thursday, September 18, 2014

How to use an Universal Storyboard in Xcode

Welcome to Part 13 of my blog series about iOS game development.

At the developer conference WWDC, in June this year, Apple showed a nice concept for targeting multiple form factors: The Universal Storyboard. Basically this replaces the iPad and the iPhone specific storyboards  with one universal storyboard. To enable different layouts for tablet and phone form factors it's working closely together with Autolayout and Size Classes.

I'll not explain Autolayout and Size Classes deeply in this post. My main motivation was to find out how to convert an old Xcode project with two storyboards into one universal storyboard. If you start a new project, the universal storyboard will be created by default.

As a start project you can use the MyGame project from my earlier posts. You can download it from GitHub: v0.9 
This sample needs Xcode 6.

Monday, July 21, 2014

How to convert/integrate SWIFT with Objective C

Welcome to Part 12 of my blog series about game development.
Today I'll show how to combine SWIFT with Objective-C code. There is no need to migrate all of your existing code to SWIFT. You’ll not sell one App more, if this is the only improvement of your new version. Not to mention all the possible new bugs you might include during the migration. A better strategy could be developing new code in SWIFT and keep existing code in Objective-C.

Prerequisite is XCode 6.1!

I've moved my blog to a new address: http://developerplayground.net
An updated version of this article for XCode 6.3 and SWIFT 1.2 can be found in my main Blog here.


I’ll show two scenarios:
  • calling SWIFT from Objective-C
  • calling Objective-C from SWIFT


Wednesday, July 2, 2014

WWDC and SWIFT

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


I've been busy the last weeks with watching WWDC videos. So much new stuff and so little time ;-). 

My favorites are Swift, Playground, Sprite Kit enhancements like the new level editor and especially this new Interface Builder Feature: It is possible to use ONE Storyboard to target both: iPad and iPhone/iPod.

Luckily Apple lifted the NDA a little bit, so it's allowed to talk about the new stuff.

But step by step...

First of all I'm planning to implement new parts of my game in SWIFT! 

What does this mean? 

One of the first things I've to figure out is how to call Objective C code from SWIFT and vice versa. I'll show this in one of my next posts.

Why?

Writing this Blog and implementing a game is one of my hobbies. I've no intention to earn money with it. Learning new things means fun for me. I just WANT to learn SWIFT. Maybe I would have taken a complete different decision in my job.

Where to start?

A good starting point to learn Swift is the official documentation from Apple. The iBooks version is available hereIf you just want to have a quick start with SWIFT you can use this Cheat Sheet, provided by Ray Wenderlich. You can also find some SWIFT tutorials on his website.



That's all for today. I want to complete the WWDC video about 'What's new in SpritKit'. In my next post I'll show how to combine SWIFT with Objective C.


Cheers,
Stefan

Thursday, June 12, 2014

HowTo: Implement a Delegate Pattern to communicate between a SpriteKit Scene and the parent ViewController

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


Today I'll show how to use a delegate pattern to communicate with the ViewController which contains our Scene. You can download the project from GitHub: v0.7 if you haven't completed part 8.

One of the most important characteristics of this pattern is 'Inversion of control'. The goal of this principle is to remove dependencies between objects. The main idea is that a 'delegator' object 'delegates' the execution a task to a 'delegate object'. You can find multiple definitions and tutorials about the Delegate Pattern. Therefore I'll not explain the pattern itself, but show how you can use it for the following Situation:



After creating a new SpriteKit project you typically have a ViewController which has a reference to a SKScene object:

The ViewController presents the screen and starts the game. This works fine as long as the game lasts. But what can you do, if the game is over?