Here's what we use on Era Dev. It's as accurate as possible, just make sure you have the actual point you hit at the right location. Try showing a polygon dot there until it's correct.
PHP Code:
function attackPlayers(dx, dy) {
for (temp.pl : findNearestPlayers(dx, dy)) {
if (! (dx in |pl.x, pl.x + 3| && dy in |pl.y, pl.y + 3|)) {
continue;
}
pl.chat = "owww!!!";
}
}
We're using this for melee attacks:
PHP Code:
temp.dx = player.x + 1.5 + vecx(dir) * 2;
temp.dy = player.y + 2 + vecy(dir) * 2;
so looks like everything is good
