There's not a lot to it:
PHP Code:
//#CLIENTSIDE
function onCreated() {
setTimer(0.05);
}
function onTimeout() {
showPolygon();
setTimer(0.05);
}
// Draw square on mousex and mousey position.
function showPolygon() {
// using showpoly
showpoly(200, {
mousex, mousey,
mousex + 2, mousey,
mousex + 2, mousey + 2,
mousex, mousey + 2
});
// Same as doing
with (findimg(200)) {
polygon = {
mousex, mousey,
mousex + 2, mousey,
mousex + 2, mousey + 2,
mousex, mousey + 2
});
}
}
The polygon array is just a collection of x, y points listed in order. I.e: {x1, y1, x2, y2, x3, y3, x4, y4};
You can use as many points as you want. I think you need at least 3 sets of x,y points though. Used to be able to draw lines with just two but i believe that changed with V5.
Other Reading:
http://gscript.graal.net/showpoly