menuWithItems:
takes an array of CCMenuItem
objects, you are sending a class itself. I don't know what the class Coin
does, but if the purpose is to show an image and then do something when it's tapped I suggest you to do this:
CCMenuItem *myCoin1 = [CCMenuItemImage
itemFromNormalImage:@"coin.png" selectedImage:@"coinSelected.png"
target:self selector:@selector(coin1WasTapped:)];
CCMenuItem *myCoin2 ...
menu = [CCMenu menuWithItems: myCoin1, myCoin2, myCoin3, ..., nil];
You should create a method coin1WasTapped:
that will be called when the coin was tapped, you can "collect" the coins here. Maybe remove them from the menu
or an animation.
If you are going to create many coins I suggest you to use a for
loop to create them all in an array. This way it will be easier to manipulate later.
This tutorial is really good, it can help you to understand better what you need to do and how to do it.
Good luck!