Hi every one well I’m on cocos2D and here is my code:
target.position = ccp(actualX, 0);
But I would like to add a random position like:
arc4random() / (UINT_MAX/2);
switch(position) {
case 0: /* top */
target.position = ccp(actualX, 200);
break;;
case 1: /* bottom */
target.position = ccp(actualX, 100);
break;
How can I do it please ? sorry for my english I’m french :/
Just get a random number between 0 and 3, and then apply your cases to each one of the cases, like below: