On collision I send my object to a random location of screen. Currently I have used two arrays and a random "chooser" to do this:
int directionsX[4];
directionsX[0] = arc4random() % (int)(320);
directionsX[1] = 320;
directionsX[2] = arc4random() % (int)(320);
directionsX[3] = 0;
int directionsY[4];
directionsY[0] = 480;
directionsY[1] = arc4random() % (int)(480);
directionsY[2] = 0;
directionsY[3] = arc4random() % (int)(480);
int chooser= arc4random() % (int)(4);
The target value of the x and y points of the tween are thus directionsX[chooser] and directionsY[chooser] respectively.
If I am not mistaken tis could also be achieved using:
if(chooser=0)
{directionsX=arc4random() % (int)(320);
directionsY=480}
And so on. Which way is more efficient and generally a better technique, or are both the same?
Thanks.