Iphone Cocos2d Game Day 4 – Collecting Coins
March 5, 2010 3 Comments
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:


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
I will try to find some time to put some instruction together on that topic.
thanks alot for that.