Archive for the ‘iPhone Game Programming’ Category

Collision Detection Methods

I’ve had a few queries about collision detection recently so I decided to share some code I’ve used to detect collisions between two circles as well as rectangles vs circles.

I will be doing a tutorial on this as soon as possible, but for the moment this code could be useful.

In SLQ I am using AABB (Axis Aligned Bounding Boxes) for the collision checks. Each entity is responsible for providing its collision bounds as a CGRect. Its then a simple process of checking each entities CGRect against another using the CGRectIntersectsRect method.

Read more

Share:
  • Digg
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Design Float
  • DZone
  • email
  • Google Bookmarks
  • LinkedIn
  • Scoopeo
  • Tumblr

If you write it they will come!!

…by they I mean of course the edits to the book. It’s in technical review now and the edits from the reviewers are starting to come through. This is really exciting as I’m starting to see what people think about the book. So far the feedback has been really positive.

I’m due to have all edits for the book by the middle of March and due to have them all addressed by the end of the month. The book should also be up on Safari Rough Cuts very soon and I’ll let you know as soon as that happens.

Read more

Share:
  • Digg
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Design Float
  • DZone
  • email
  • Google Bookmarks
  • LinkedIn
  • Scoopeo
  • Tumblr

SLQ Video Update

I’ve created a new video of SLQ to show progress. The game is almost complete now so I wanted to show everyone how it was looking. There are a couple of small areas to still fix. I’m still tweaking some sound effects for example and also working on the final map.

So, I hope you enjoy the preview and a chance to see the game being developed with the book I’m writing.

SLQ Update Video

Mike

Share:
  • Digg
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Design Float
  • DZone
  • email
  • Google Bookmarks
  • LinkedIn
  • Scoopeo
  • Tumblr

Bitmap Font Update

I’ve been meaning to update the bitmap font code for a while. I made a number of changes to this code for the book as I found problems with the rendering of characters for some fonts. This was done to bugs in my code that positioned each character rendered. I fixed these for the book code and I’ve just updated the Tutorial 4 project code with the same fixes.

If you were seeing odd alignment of characters then the fixes in the Bitmap Font tutorial code should sort them out. It also ensures that the point provided when rendering text is used as the bottom left hand corner of the first character.

Hope this helps people and let me know how you get on.

Tutorial 4 – Bitmap Fonts

Mike

Share:
  • Digg
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Design Float
  • DZone
  • email
  • Google Bookmarks
  • LinkedIn
  • Scoopeo
  • Tumblr

Recent readers games

Apologies to those who have sent me information on their games which they have released based on some part on the tutorials. I am behind on getting these mentioned on the blog, but this post should fix that.

I continue to get updates from blog readers who are pushing on and getting their own games released on the App store which is fantastic. I love to see other peoples creations and how they have use the tutorials in new and unique ways. Below is a list of games that I’ve been told about recently. I’m sure you all realise the amount of time that goes into creating your own game, especially when you are creating your own game engine as well and not using something like Cocos2d. For that reason alone I hope that you check out the games below as they all deserve it.

Read more

Share:
  • Digg
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Design Float
  • DZone
  • email
  • Google Bookmarks
  • LinkedIn
  • Scoopeo
  • Tumblr

Latest Sound Manager Class

I’ve finally managed to upload the latest version of the SoundManager class. This is the same version I am using in Sir Lamorak’s Quest. There are a few changes from the class in the tutorials. I’ve added some new methods

- (void)playNextTrack;
- (void)addToPlaylistNamed:(NSString*)aPlaylistName track:(NSString*)aTrackName;
- (void)startPlaylistNamed:(NSString*)aPlaylistName;
- (void)removeFromPlaylistNamed:(NSString*)aPlaylistName track:(NSString*)aTrackName;
- (void)removePlaylistNamed:(NSString*)aPlaylistName;
- (void)clearPlaylistNamed:(NSString*)aPlaylistName;
- (void)fadeMusicVolumeFrom:(float)aFromVolume toVolume:(float)aToVolume duration:(float)aSeconds stop:(BOOL)aStop;


Read more

Share:
  • Digg
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Design Float
  • DZone
  • email
  • Google Bookmarks
  • LinkedIn
  • Scoopeo
  • Tumblr

Sound Manager Update

Hi all

By the end of this weekend I will post a new version of the Sound Manager. I’ve been introducing music into SLQ and found that there were some features missing from the SoundManager class that would be handy such as named play lists, fading music etc.

I’ve added these features now as well as fixing memory leaks that had been reported. I just need to work on a couple of areas over the weekend and I’ll then post the new version. I just wanted to keep you up to date.

Mike

Share:
  • Digg
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Design Float
  • DZone
  • email
  • Google Bookmarks
  • LinkedIn
  • Scoopeo
  • Tumblr

New Sound Manager Version

If you have followed the tutorials you will know that tutorial 9 covered the sound manager classes. Since the tutorial I’ve been making updates to those classes so that they correctly handle sound interruptions, such as alarms or phone calls. There are also a number of other bug fixes that I’ve added as well to areas such as the removal of sounds when they are no longer needed.

This is the same version of the sound manager that is being use in Sir Lamorak’s Quest and its been performing really well. Hope it helps.

New SoundManager Classes

Mike

Share:
  • Digg
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Design Float
  • DZone
  • email
  • Google Bookmarks
  • LinkedIn
  • Scoopeo
  • Tumblr

Project 72

I came across a site yesterday which is documenting in real time a team of four guys who writing an iPhone game in 71 hours, hence the name of the project.

They all seem to have experience already and hence thought they could create the entire game in 7 days, with the actual game coding being done in 71 hours. Their website is tracking a countdown timer and also has a live web cam of them working away. It also has regular video updates of their progress on the game which is not looking bad at all.

Read more

Share:
  • Digg
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Design Float
  • DZone
  • email
  • Google Bookmarks
  • LinkedIn
  • Scoopeo
  • Tumblr

Iphone Game Programming – Tutorial 12 – Saving State

I’ve managed to squeeze in one last small tutorial for 2009. I had a request on the blog for a tutorial on saving game state. This is only a quicky and I’ve built it on the code from Tutorial 11. It covers how I’ve used NSCoding to store game state which is really easy to do.

Tutorial 12

Tutorial 12 Project

I hope you enjoy it and have a great Christmas :o)

Upate 23/12/09: Kurt commented on the tutorial and pointed out that I am over retaining myObject when it is loaded from the decoder. As I am using self.myObject and the property is defined as retain, doing a further retain when reading it in would in fact leak myObject. I have changed the source code and removed the unnecessary retain. I don’t use self in the SLQ code and hence need the retain. More haste less speed they say :o)

Mike

Share:
  • Digg
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Design Float
  • DZone
  • email
  • Google Bookmarks
  • LinkedIn
  • Scoopeo
  • Tumblr

Twitter (@71squared)

About the authors

John is a Web Developer working in Perth, Australia for Bouncing Orange - graphic + web design.

Mike works for Vindicia, the leading subscription and payment management solution for digital merchants.

They both love technology, especially Apple.