How to create background Music for your Game

So you have programmed your game and you are ready to submit it for sale. But wait, you have no background music. What to do?

You could pay someone to create the music for you but why not do it yourself?

With the fantastic array of music apps available on iOS now, you can create music for games or anything else and it has never been easier.

Propellerhead has a fantastic app available called Figure and at 0.99c it is very affordable.

With a wealth of sounds, tempo and key changes availability you can create a background music masterpiece to suit your needs.  Tap out your drum beat, move your finger around to play your bass and keyboard. Then change the filters and mix away until you have exactly the sound you want.

Once you are happy with the sound, save it and export the file to your Mac. Now just have your game engine loop the file and your background soundtrack is complete.  It is so easy and quick to make music you can spend the extra time creating more background tracks and changing what plays in your game over time.

But that is not where it stops. Enter AudioBus, another fantastic app that lets music apps on iOS talk to each other.

With a growing community of supported music apps the options are endless –

With access to free and paid quality music apps that now talk to each other on iOS, the world of creating music has really opened up, not only for musicians but for us game developers as well.


Unity 4 – Mecanim, Navmeshagent and Ragdoll test

So I have had some time to play with the new version of Unity 3D (version 4) and I decided to play with the new Mecanim animation system and how it works with a NavMeshAgent and a Ragdoll.

For a good starter video tutorial and demo scene on the Mecanim animation system go here:

I decided to see what I could do with the Mecanim animation system, the Navmesh system (Pro version only) and the ragdoll system.

I was very happy to see how easy it is to set up a character with the new Mecanim system. I had a zombie running around my scene in no time at all after watching the about tutorial on the system.

I then created a NavMeshAgent version of the zombie and saved it as a prefab so I could use it later by spawning the zombies on the go.

The video demo below has 200 zombie that are destroyed by explosions and respawner.

I then starting to think it would be nice to change from the Mecanim system to the Ragdoll system when the zombie get hit by the explosion. This turned out to be very easy as well. I just created a ragdoll zombie prefab so I could create it over and over when I needed it.

The zombies have a rigidbody attached to them and a box collider that is use as just a trigger. When the explosion hits the zombie it checks that it is hit by an explosion object (using a tag name) and then if it is an explosion object that has hit the zombie, the zombie object creates a ragdoll version of itself in its current location from the prefab. It then destroys itself and the new ragdoll version of the zombie is affected by the Rigidbody.AddExplosionForce function that the explosion object has on it.

The explosion trigger is just a Physics.Raycast from the camera to the ground and the explosion goes off at the ground hit point.

Here is the first video test of this process:

Cocos2d – detecting iPhone, iPhone HD, iPad and iPad HD

This is just a quick post with some source code attached to help other Indie developers in detecting which device their code is running on.

This source code – – detects which device the code is running on and loads the correct background image to display.

I hope it helps someone and if you think it can be improved please leave a comment.

Below is the code we are interested in.

if ([UIScreen instancesRespondToSelector:@selector(scale)])


//So we grab the screens scale factor – 1.0 = SD screen & 2.0 = HD screen

CGFloat scale = [[UIScreen mainScreen] scale];

 //and now we grab the device model – we are only interested in if it is an iPhone or iPad

NSString* valueDevice = [[UIDevice currentDevice] model];       //and now we grab the device model – we are only interested in if it is an iPhone or iPad

if (scale > 1.0)  //If the scale factor is not 1.0 it is a HD screen


CCLOG(@”HD Screen”);

if ([valueDevice rangeOfString:@”iPad”].location == NSNotFound)  //Test to see if our valueDevice NSString does not contains the substring iPad & if it does not it is an iPhone otherwise it is an iPad 


NSLog(@”iPhone HD”);  //HD iPhone load HD iPhone graphic

screenToLoad = @”screenHDiPhone.pvr.ccz”;

pListToLoad = @”screenHDiPhone.plist”;

imageToLoad = @”Screen960x720.png”;

} else {

NSLog(@”iPad HD”); //HD iPad load HD iPad graphic

screenToLoad = @”screenHDiPad.pvr.ccz”;

pListToLoad = @”screenHDiPad.plist”;

imageToLoad = @”Screen2048x1536.png”;


}else { //and if the scale factor is 1.0 then it is a SD screen

CCLOG(@”SD Screen”);

if ([valueDevice rangeOfString:@”iPad”].location == NSNotFound) //Test to see if our valueDevice NSString does not contains the substring iPad & if it does not it is an iPhone otherwise it is an iPad 


NSLog(@”iPhone”);  //SD iPhone load SD iPhone graphic

screenToLoad = @”screeniPhone.pvr.ccz”;

pListToLoad = @”screeniPhone.plist”;

imageToLoad = @”Screen480x360.png”;

} else {

NSLog(@”iPad”); //SD iPad load SD iPad graphic

screenToLoad = @”screeniPad.pvr.ccz”;

pListToLoad = @”screeniPad.plist”;

imageToLoad = @”Screen1024x768.png”;




I hope the above comments helps explain how the code is working.


A Helpful feature of the JoyPad SDK

So I have been playing with the JoyPad SDK and have discovered that you can control the simulator with your iPhone when you use the JoyPad SDK – and have it running thru your home WI-FI system.

So now we can control our apps using iPhone screen touches and have it displayed on our Mac screen for screen capture software to record the interaction with our games and other apps.

Will provide the source code for this demo soon.

Here is a quick sample video of a sprite running on the iPad simulator but controlled by my iPhone.

Star Chase v1.1 ready to be submitted – video Game Play Demo

The next version of Star Chase is ready to be submit and I have done the following:

Optimised sprite drawing code.

Added particle effect for bombs with particle explosion ring

Added New stars to collect:
Gold stars = 500 points
Purple Stars = 300 points
Blue Stars = 250 points
Red Stars = 200 points
Green Stars = 150 points

Here is a quick YouTube clip of the game play:

My First iPhone/iPad Game and it is available now – Star Chase

Well I have submitted my first game to Apple and it is available now.

Star Chase –

I have gone with a universal binary as I do not like paying for iPhone and iPad versions of games.  I also have an introduction price set to 0.99c and it will go up shortly after the release. But it will not be outrages as again I do not like paying to much for games on the iPad.

Here is a brief description of the game.

Destroy countless Alien enemies as fast as you can in this dual stick retro style arcade shooter. Then collect as many stars that the aliens drop when they get destroyed as fast as you can before they disappear.

The number of stars you collect are added together from game to game so your position on the Total Stars Collected Leaderboard will always be changing.

Compete with your friends to be number one on three Game Center Leaderboards – Stars collected in a single game, Total Stars collected or the Highest Score.

Would you like to switch the virtual joystick over – not a problem – select yes so that the left joystick fires and the right one controls your ship instead of the default which is the other way around.


  • Control your ship with one joystick and shoot with the other joystick for independed ship and bullet direction.
  • Double tap to drop bombs.
  • 3 Game Centre Leaderboards
  • 19 Game Centre Achievements with more on the way
  • Power ups to help destroy more enemies or restore your shield
  • Original Graphics
  • Original soundtrack

#Cocos2d Tutorials and Information

I have been helping several people on twitter over the last few weeks to get started with Cocos2d – – so I thought I would put together a list of useful sites and other information all in one spot.

Your first stop should be the Cocos2d documentation and forums:

People to follow on Twitter:


Useful tools to help with game Design:

Feel free to add more links in the comments section below.

Rotating and animating a simple ship using Cocos2d and SneakyInput

First off I would like to thank Andreas for making his TexturePacker software available for free to development bloggers – and Mike of for providing me with a copy of Particle Designer which I will do a separate blog on later once I have had time to play with it some more –

I have been playing with Cocos2d for a little while now and have read lots of tutorials, forum posts and blogs and have decided to share this post as I have not seen any posts about rotating a CCsprite in Cocos2d –  – using  the degrees from SneakyInput – and changing the sprite as it rotates using a spritesheet.

I am going to be using this spritesheet:

Simple Ship Spritesheet

Here is a quick youTube click of how it all looks running:

If you want to follow along you can download the source code from here –

In GameScene.m file, we just create our sprite cache:

[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@”Simple_Ship.plist”];

then our player:

player = [[Player alloc] initWithGame:self];   –  this also sets our start frame for our sprite to display.

and then our joystick:

gameJoystick = [[JoyStick alloc] initWithGame:self];   –   I have set up a right hand side joystick as well which is not used as yet as I want to control my bullets separately to the player. I have included a simple skin for the joystick as well.  For some reason I have to create the texture cache again in the Joystick.m file as it can not see it otherwise.  If anyone knows how to get around this, please leave a comment.

All of this code I have found out about in other tutorials:

sharedSpriteFrameCache –

SneakyInput Tutorial –

Changing the CCSprite display frame –

Then in our update function all the magic happens:

Using CGSize winSize = [[CCDirector sharedDirector] winSize];

We put the player on the other side of the screen when it goes off the screen.

//Keep the Player on the iPad screen by putting player on other side of screen when it goes off the screen

if (player.playerSprite.position.y >= winSize.height+4) {

[player.playerSprite setPosition:ccp(player.playerSprite.position.x, -10)];


if (player.playerSprite.position.y <-10) {

[player.playerSprite setPosition:ccp(player.playerSprite.position.x, winSize.height+4)];


if (player.playerSprite.position.x >=winSize.width+4) {

[player.playerSprite setPosition:ccp(-10, player.playerSprite.position.y)];


if (player.playerSprite.position.x <-10) {

[player.playerSprite setPosition:ccp(winSize.width+4, player.playerSprite.position.y)];


Then using the degrees from our joystick we set the appropriate frame to display for our sprite.

int i = (int) gameJoystick.leftJoystick.degrees/6;         //work out the animation frame we need depending on the Joystick Degree

//Then we create the frame name using Simple_Ship and the value of the int i

NSString *playerframes = [NSString stringWithFormat:@”Simple_Ship00%02i.png”, i];

//Then get the frame to show

CCSpriteFrame *frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:playerframes];

//Then assign the frame to display to the player sprite

[player.playerSprite setDisplayFrame:frame];

Our animation has 61 frames going from 0 to 60. You need to include a frame 0 as there is a 0 degrees value.

Also I found out that your animation needs to go in a anti-clockwise direction as that is the way sneakyInput degrees goes.

I divide the degrees by 6 as there are 61 frames.

Have a play with the source code and if there is a better way of doing any thing please feel free to leave a comment with the details.