View Single Post
  #2  
Old 08-26-2011, 11:54 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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, {
     
mousexmousey,
     
mousex 2mousey,
     
mousex 2mousey 2,
     
mousexmousey 2
  
});

  
// Same as doing
  
with (findimg(200)) {
    
polygon = {
     
mousexmousey,
     
mousex 2mousey,
     
mousex 2mousey 2,
     
mousexmousey 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
__________________
Quote:
Reply With Quote