Hey guys!
Sorry I havent replied in a while, I havent had time to work at all on my game since the last time
@Khris: WOw, this is great! I tried it, everything works with a "normal" player, however when I use it with my car player, Ive got this line in rep_exec (taken from the Taxi Demo game):
Code: ags
How do I integrate that to your script so that the car's front/back part of the sprite is detected exactly when it touches the region? Right now since Ihave those 2 lines, the car can "enter" the region almost halfway before triggering my debug line "player is inside region":
Code: ags

@Sephiroth: Wow thanks for that script
Im going to try that tonight and see how it goes: I can use it in conjunction with Khris's and see what I come up with. Ill post the results so others can use it too! 
**Code: ags doesnt seem to work right now (?)[/s]
Sorry I havent replied in a while, I havent had time to work at all on my game since the last time

@Khris: WOw, this is great! I tried it, everything works with a "normal" player, however when I use it with my car player, Ive got this line in rep_exec (taken from the Taxi Demo game):
player.x = oCar.X + half_sprite_size;
player.y = oCar.Y - half_sprite_size;
How do I integrate that to your script so that the car's front/back part of the sprite is detected exactly when it touches the region? Right now since Ihave those 2 lines, the car can "enter" the region almost halfway before triggering my debug line "player is inside region":
bool InsideBounds_ISO(this Character*, int iX1, int iY1, int iX2, int iY2) //iMinX's vector (x,y) and iMax's vector(x,y)
{
int iXp = this.x;
int iYp = this.y;
// d is vector from X1;Y1 to X2;Y2
float dx = IntToFloat(iX2 - iX1), dy = IntToFloat(iY2 - iY1);
// a is vector from X1;Y1 to top corner
// b is vector from X1;Y1 to bottom corner (a + b = d)
float bx = (m*dx - dy)/(2.0*m);
float ax = dx - bx;
float ay = m * ax, by = -m * bx;
// express character coords using a & b
// p is vector from X1,Y1 to character
float px = IntToFloat(iXp - iX1), py = IntToFloat(iYp - iY1);
float det = ay*bx - ax*by;
// p = k*a + l*b
float k = (bx*py - by*px)/det;
float l = (ay*px - ax*py)/det;
// => if both k & l are inside [0;1], character is inside parallelogram
return (k >= 0.0 && k <= 1.0 && l >= 0.0 && l <= 1.0);
}
// in rep_exec:
if (player.InsideBounds_ISO(2323, 1593, 2473, 1623)) //REGION A
{
Display("player is inside REGION A!"); //debug line
}

@Sephiroth: Wow thanks for that script

