Iphone Cocos2d Game Day 4 – Collecting Coins

On day 4 I decided to attempt creating a “coin type” object and collect them using collision. Since I am using box2d for the player I created the coin sprites with a body but my problem was gravity. Everytime a coin was drawn it would fall down and bounce. To solve this I attempted turning the gravity off for the coin body (which I found a tutorial for doing this) BUT I could not get it to work. So I just left the bouncing coins and moved on to collecting them.

Collecting them was fairly easy and I got it to work in no time so I added a coins count with a label in the top right corner of the screen. I setup a magic number of 10 coins collected wins you the game. Once you win it tells you then restarts.

This was a fun exercise but I quickly found that in order to create some of the features I want in my game, Box2d will be very time-consuming for a beginner like myself. I think I might go with creating the game completely out of Cocos2d, which I seem to have better luck understanding, meaning no more Box2d?

Here is my Day 4 Video:

Advertisements

3 Responses to Iphone Cocos2d Game Day 4 – Collecting Coins

  1. cl says:

    can you show on how to collect coins, I’m having a bit of trouble with that now. thanks, and i love the site. helps me alot

  2. cl says:

    thanks alot for that.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: