I am new in making a 2d game in cocos2d, the issue is that I want to make the enemies in portrait mode , and the code is that
int minY = target.contentSize.height/2; //min = 40/2 =>20
int maxY = winSize.height - target.contentSize.height/2; //maxY = 320 - (40/2)=>300
int rangeY = maxY - minY; //rangeY = 300-20 =>280
int actualY = (arc4random() % rangeY) + minY; //actually = (rand()%280)+20
NSLog(@"minY value is: %i, maxY value is: %i, rangeY value is: %i", minY, maxY, rangeY);
NSLog(@"actualY value is: %i", actualY);
// Create the target slightly off-screen along the right edge,
// and along a random position along the Y axis as calculated above
// target.position = ccp(winSize.width ,(target.contentSize.width/2)+actualY );
target.position = ccp(winSize.width, (target.contentSize.width/2)+actualY);