AaronChapmanDev
AaronChapmanDev

Reputation: 124

cocos2D automatic moving image

Everything looks fine, I have no errors, yet, when I run the program it crashes. Please help, I'm getting frustrated. Here's what I have:

-(id) init {

if( (self=[super init])) {


    homeCloud1 = [CCSprite spriteWithFile:@"homeCloud1.png"];
    homeCloud1.position = ccp(140,200);
    [self addChild:homeCloud1];


    [self schedule:@selector(callEveryFrame)];


    }

return self;
}



-(void) callEveryFrame: (ccTime) dt {

homeCloud1.position = ccp(homeCloud1.position.x +20*dt, homeCloud1.position.y);
if (homeCloud1.position.x > 480+30) {
    homeCloud1.position = ccp(-30, homeCloud1.position.y);
    }

}

Upvotes: 2

Views: 462

Answers (1)

tassinari
tassinari

Reputation: 2363

Cant say for sure, post your crash log but there is one error I see

[self schedule:@selector(callEveryFrame)];

needs a colon

[self schedule:@selector(callEveryFrame:)]; 

Upvotes: 3

Related Questions