Reputation: 335
I need someone's help. Actually I have no idea what to replace to get a custom background image. I'm just can't do it anymore.
-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super's" return value
if( (self=[super initWithColor:ccc4(219,31,94, 999)]) ) {
ws=[[CCDirector sharedDirector]winSize];
NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"game" ofType:@"wav"];
NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:nil];
player.numberOfLoops=-1;
[player play];
Upvotes: 0
Views: 30
Reputation: 23882
Create and add a CCSprite
:
CCSprite *bg = [CCSprite spriteWithFile:@"bg.png"];
bg.tag = 1;
bg.anchorPoint = CGPointMake(0, 0);
[self addChild:bg];
Upvotes: 1