I want to display the shapes with dynamic position.
Ex..
A B C D
D A B E
E B D A
Here the coding:
string names[] = {
"AB",
"ABC",
"ABCZ",
"ABCDEDF",
};
void HelloWorld::addShapes(HelloWorld* game)
{
name = names[arc4random()%4];
......
.....
CCPoint pos1[8];
for (int i = 0; i< TempNumOne; i++)
{
pos1[i]=CCPoint(disx, disy);
}
for (int a=0; a<TempNumOne; a++)
{
Filename[a]=FileMeasure[a];
int temp= arc4random()%TempNumOne;
......
bodyDef.position.Set(pos1[temp].x/32.0f, pos1[temp].y/32.0f);
.....
switch (Filename[a])
{
case 'A':
{
......
}
case 'B':
{
......
}
etc.....
}
All the logic working fine except dynamic position.
Sometime arc4random function returns the same values in the looping statement. I have same position for two shapes.
I want to display the shapes different position.
Can any one assist me?