Hi, I'm getting an uncaught exception error when I try to add sprites to an array, and everything looks fine to me.. I'm using MonocleStudios Simplegame project for this monoclestudios dot com/static/simplegame.zip
Code should be fairly self-explanatory:
[code]
@implementation GameScene
(id) init { self = [super init]; if (self != nil) {
Sprite * bg = [Sprite spriteWithFile:@"game.png"]; [bg setPosition:ccp(240, 60)]; [self addChild:bg z:0]; [self addChild:[GameLayer node] z:1]; Sprite * bg1 = [Sprite spriteWithFile:@"game.png"]; [bg1 setPosition:ccp(211, 260)]; [self addChild:bg1 z:0]; //the above works fine! Sprite * bgX[50]; //if comment out the next 3 lines, everything runs but I get an "unused variable" warning bgX[0] = [Sprite spriteWithFile:@"mytree.png"]; [bgX[0] setPosition:ccp(240,150)]; [self addChild:bgX[0] z:0]; } return self;
}
@end
[/code]