Modal view controllers in cocos2d

Today’s post is going to be a tutorial-style one. One of the (few) annoying things of cocos2d is the fact that it is very unrelated to UIKit and the Model View Controller paradigm of Apple’s views a view controllers. This is a problem when you need to show, for example, a view controller modally to send an e-mail or show Game Center leaderboards and achievements.

In this tutorial I am going to describe the technique I use to connect with “Apple’s layer” from cocos2d in an easy, modular, reusable way. You will find the project source code used on this tutorial at the end of this post.

Cocos2d Mug

Continue reading

Using sprite sheets in Cocos2d and Tiled (part 2)

Today’s post is the second part of last week post about using sprite sheets with cocos2d and Tiled. In the previous post we saw what is a sprite sheet, how to to create it from a collection of individual sprites using Texture Packer and how to code it using cocos2d for iPhone. Today I’m going to explain how I used sprite sheets as source libraries in Tiled to create and edit New Sokoban puzzles. In this previous post I partially covered this topic. However, today I’m going to enter in more detail into some technical issues.

As we saw in the first part of this article, sprite sheets are mainly used to drastically improve our games performance in terms of both memory and CPU usage. We basically need to group our original individual sprites and then have some way to refer to them in our game code.

Vegeta Sprite Sheet

Vegeta Sprite Sheet

Continue reading

Using sprite sheets in Cocos2d and Tiled (part 1)

In today’s post I’m going to enter in more detail in a very useful topic for game development: Sprite Sheets. I introduced this topic in two of my previous post, but did not enter in detail. I received some feedback pointing out that there is some interest on sprite sheets and how to use them in conjunction with Texture Packer and Cocos2d. In addition, I’m also going to explain how to use sprite sheets as your source library for creating maps on Tiled. This will probably be a large post, so I’m going to split it into two parts.

Super Mario World Sprite Sheet

Super Mario World Sprite Sheet

Continue reading

Game Center integration – leaderboards and achievements

Today’s post is going to be a pragmatic and technical one. I’m going to make a brief introduction to Game Center integration for your games. I decided to talk about this topic today because I found some things that I was not expecting about Game Center. So, I going to share my experience.

As you may know, Game Center is Apple’s solution to social gaming experience. It’s not the best social gaming experience, but its acceptance has been very high among iOS users and it’s quite easy to implement. That’s why I finally decided to only support Game Center, forgetting about Open Feint or Plus+.

game center icon

Continue reading