Hi !!
I'm making sort of a tile puzzle with 16 objects which have to be placed in certain coordinates in a random order before fadein. For help with the random order of the tiles I found this thread, where Lt. Smash provided some code:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=35405.msg463913#msg463913 (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=35405.msg463913#msg463913)
I put the code in the script header and in the main script but I keep getting this message:
QuoteVariable '::' is already defined
Can anybody tell me what could be wrong?
Thanks!
my scripts:
in GlobalScript.ash:
struct coordinates
{
int x;
int y;
bool used;
};
import coordinates Point[15];
struct mem //in that struct you can add your functions for pair checking etc.
{
import void mix();
};
import mem Memory;
in GlobalScript.asc:
coordinates Point[15];
export Point;
mem Memory; //on top
export Memory;
mem::mix()
{
int i;
while (i < 15) { //reseting memory
Point[i].used = false;
i++;
}
i = 0;
int pos;
while (i < 15) { //mixing the tiles
pos = Random (15-1);
if (!Point[pos].used)
{
Point[pos].used = true;
object[i].SetPosition(Point[pos].x, Point[pos].y);
i++;
}
}
}
in room_Load:
Point[0].x = 60;
Point[0].y = 50;
Point[1].x = 110;
Point[1].y = 50;
Point[2].x = 160;
Point[2].y = 50;
Point[3].x = 210;
Point[3].y = 50;
Point[4].x = 60;
Point[4].y = 100;
Point[5].x = 110;
Point[5].y = 100;
Point[6].x = 160;
Point[6].y = 100;
Point[7].x = 210;
Point[7].y = 100;
Point[8].x = 60;
Point[8].y = 150;
Point[9].x = 110;
Point[9].y = 150;
Point[10].x = 160;
Point[10].y = 150;
Point[11].x = 210;
Point[11].y = 150;
Point[12].x = 60;
Point[12].y = 200;
Point[13].x = 110;
Point[13].y = 200;
Point[14].x = 160;
Point[14].y = 200;
Point[15].x = 210;
Point[15].y = 200;
Memory.mix();
Thank you, Khris. Now it works as it should!