Quote:
Originally posted by emortylone
NPC Code:
if (created)
{ timeout=0.25;}
if (timeout)
{ if (abs(mousex-x)=<1 && abs(mousey-y)=<1)
{ actions;}
timeout=0.25;
}
|
It would just check that the mouse is within a distance of one tile from the
top left corner.
This might be a bit better:
NPC Code:
if (playerenters || timeout) {
if (mousex >= x && mousex < x+npcs[0].width &&
mousey >= y && mousey < y+npcs[0].height) {
// do stuff
}
timereverywhere;
timeout = 0.05;
}