I have the following script running:
PHP Code:
if (horsecheck == true) {
wall[0] = onwater2(player.x+check[k][0][0],player.y+check[k][0][1],check[k][2][0],check[k][2][1]);
wall[1] = onwater2(player.x+check[k][1][0],player.y+check[k][1][1],check[k][2][0],check[k][2][1]);
} else {
wall[0] = onwall2(player.x+check[k][0][0],player.y+check[k][0][1],check[k][2][0],check[k][2][1]);
wall[1] = onwall2(player.x+check[k][1][0],player.y+check[k][1][1],check[k][2][0],check[k][2][1]);
}
Basically, if the player is riding a horse it will check for water, and if not it will check for a wall.
They both use the exact same checks. With wall checking, the detection is perfect. However, if I start trying to detect water, half the time the player will go halfway into the body of water and such. It seems to have a slight delay in actually registering water.
This is clientside, by the way. Can this please be fixed?
edit: after some testing, onwater2(x,y,1,1) will only check a one pixel area for water, NOT 1 tile, like onwall2. HOWEVER, onwater2(x,y,2,2) functions the same as onwall2(x,y,1,1)... so I don't know what the hell is going on.
Here's in the script I used to test:
PHP Code:
showpoly(200,{mousex-1,mousey,mousex-1+1,mousey,mousex-1+1,mousey+1,mousex-1,mousey+1});
changeimgcolors(200,1,0,0,.25);
showpoly(201,{mousex,mousey,mousex+1,mousey,mousex+1,mousey+1,mousex,mousey+1});
changeimgcolors(201,0,1,0,.25);
player.chat = onwater2(mousex-1,mousey,1,1) SPC onwall2(mousex,mousey,1,1);

Red box represents my water check, and the green is the wall check. Both are identical, except one returns true(the onwall2) and one does not -- these results are also shown over the player's head, left is the water check and right is the wall.