So i have a “old” game i made, i wanna try make it for iPhone(ofc).
Can some one please help me try rewrite this into cocos2d ? im using xcode 4, think thers a bit different about the releases, of what i have heard, but dunno..
But thanks in advance
heres my AS3 code:
for (i = 0; i < 11; i++)
{
columns = [];
for (j = 0; j < 11; j++)
{
_place = new place();
_place.thisX=i;
_place.thisY=j;
_place.thisDistance=Math.min(i+1,j+1,11-i,11-j)*11;
_place.y = 56 * i + 3;
_place.x = 5 + 71 * j + 35*(i%2);
_place.buttonMode=true;
_place.addEventListener(MouseEvent.CLICK, setBlock);
columns[j] = _place;
addChild(_place);
}
rows[i] = columns;
}
i’ve got this so far, but its prob. wrong
place = [CCSprite spriteWithFile:@"place.gif"];
int *i;
int *j;
CCSprite *_place = place;
CCArray *columns;
for (i = 0; i < 11; i++) {
columns = [];
for (j = 0; j < 11; j++) {
_place.position.x = ccp(i);
_place.position.y = ccp(j);
}
}
are you sure your code is written in c++, objective-c or just native c? this is how you have to implement your code :
and you can also add
[layer addChild:places[i][j]]at the end of for loop to add them to your layer at creation time.–edit–
and for creating a UI just as I can get from your AC3 script I would prefer using CCMenu class:
something like this :