need some advice / pointed in right direction to solve this.. school lad.. not homework!! personal learning. i can't figure out how to get the spites to go from top to bottom. the code below makes them left to right. thanks in advance.
CCSprite * monster = [CCSprite spriteWithFile:@"image.png"];
// Determine where to spawn the monster along the Y axis
CGSize winSize = [CCDirector sharedDirector].winSize;
int minX = monster.contentSize.width/ 0.2;
int maxX = winSize.height - monster1.contentSize.width/2;
int rangeX = maxX - minX;
int actualX = (arc4random() % rangeX) + minX;
// Create the monster slightly off-screen along the right edge,
// and along a random position along the Y axis as calculated above
monster.position = ccp(winSize1.width + monster.contentSize.width/2, actualX);
[self addChild:monster1];
// Determine speed of the monster
int minDuration = 2.0;
int maxDuration = 4.0;
int rangeDuration = maxDuration - minDuration;
int actualDuration = (arc4random() % rangeDuration) + minDuration;
// Create the actions
CCMoveTo * actionMove = [CCMoveTo actionWithDuration:actualDuration
position:ccp(-monster.contentSize.width/2, actualX)];
CCCallBlockN * actionMoveDone = [CCCallBlockN actionWithBlock:^(CCNode *node) {
[node removeFromParentAndCleanup:YES];
}];
[monster1 runAction:[CCSequence actions:actionMove, actionMoveDone, nil]];