/ Published in: Objective C
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
for (int i = 0; i < 9; i++ ) { //create a slot object with a label //add the object to the slots array //sprite [slots addObject: [[[Slot alloc] initWithSprite:[CCSprite spriteWithFile:@"hole.png"] withPos_x:count%3*cellWidth+offset_x withPos_y:count/3*cellHeight+offset_y isOccupied:NO] autorelease]]; //add the sprite to the layer [self addChild: ((Slot*) [slots objectAtIndex:i]).sprite]; count++; }