使用此代码怪物不会出现,只有英雄节目
for (int j = 0; j <= _discrH; j++)
{
for (int i = 0; i <= _discrW; i++)
{
CCSprite * sprite = [CCSprite spriteWithImageNamed:@"monster.png"] ;
sprite.position = ccp([self getCanvasXFromGameI : i],[self getCanvasYFromGameJ : j]);
[_sprites addObject:sprite ];
[self addChild:sprite];
}
}
_hero = [CCSprite spriteWithImageNamed:@"case1.png"];
_hero.position = ccp(0,0);
[self addChild:_hero];
但是使用这个(无意义的)代码,怪物和英雄显示,我不明白为什么......
for (int j = 0; j <= _discrH; j++)
{
for (int i = 0; i <= _discrW; i++)
{
CCSprite * sprite = [CCSprite spriteWithImageNamed:@"monster.png"] ;
sprite.position = ccp([self getCanvasXFromGameI : i],[self getCanvasYFromGameJ : j]);
[_sprites addObject:sprite ];
[self addChild:sprite];
}
_hero = [CCSprite spriteWithImageNamed:@"case1.png"];
_hero.position = ccp(0,0);
[self addChild:_hero];
}
任何想法我做错了什么?