// place in global code
#define NORTH 1
#define SOUTH 2
#define EAST 4
#define WEST 8
if(CopMap[cop.x,cop.y] == NORTH+SOUTH) // NORTH+SOUTH actually equals 3
{
do stuff here
}
char CopMap[16][16] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
}
char movedir;
do
{
movedir = rand(3.99999);
}while((CopMap[xloc][yloc] & pow(2, movedir)) == 0);
switch(movedir)
{
case 0: //move north
MoveTo("Event Actor", 0, -size, velocity, "Event Actor", "");
//change animation
break;
case 1: //move south
MoveTo("Event Actor", 0, size, velocity, "Event Actor", "");
//change animation
break;
case 2: //move east
MoveTo("Event Actor", size, 0, velocity, "Event Actor", "");
//change animation
break;
case 3: //move west
MoveTo("Event Actor", -size, 0, velocity, "Event Actor", "");
//change animation
break;
}
Users browsing this forum: No registered users and 1 guest