Arrays as slots
With games that require slots and pieces I'd generally use a pointer array for the slots, initialize them with NULL and then fill them with a pointer to the piece that later occupies them. This makes it easy to check if slot 2 is empty or replace an item in slot 4.
This seems to be problematic in Objective C due to the dynamic nature of NSMutableArray and ccArray and the inability to assign NULL/nil to an index. Is there a simple solution or similar trick for Objective C / Cocos2d?
|