C-Dawg
10-18-2006, 09:13 PM
Saffith uses the "canMove" function, which I presume checks whether a given location is walkable on layer 0. I'd like to use this function too, but I don't see it posted anywhere.
Any clues?
EDIT - Nevermind, I found it.
// Check whether the trap can move into a certain tile.
// Returns true if the tile on layer 0 is within the
// range of the screen and no part of it is solid.
bool canMove(int x, int y)
{
if(x<0 || x>240 || y<0 || y>160)
return false;
return Screen->ComboS[y+(x>>4)]==0;
}
}
EDIT 2 - Aaaaand now I'm getting an error message that "screen" is undefined. What the...
EDIT 3 - Apparently the "screen" pointer can only be used INSIDE an ffc script. It cannot be placed in a global function.
Any clues?
EDIT - Nevermind, I found it.
// Check whether the trap can move into a certain tile.
// Returns true if the tile on layer 0 is within the
// range of the screen and no part of it is solid.
bool canMove(int x, int y)
{
if(x<0 || x>240 || y<0 || y>160)
return false;
return Screen->ComboS[y+(x>>4)]==0;
}
}
EDIT 2 - Aaaaand now I'm getting an error message that "screen" is undefined. What the...
EDIT 3 - Apparently the "screen" pointer can only be used INSIDE an ffc script. It cannot be placed in a global function.