Post here any useful API functions to be included in our API library, I'll start by two that draw rectangles, please add your own to make API easier for people :)
//common API module by Inglor, Inglor@gmail.com
//made for Newgrounds.com
/*
functions:
rectangle(startx, starty,endx,endy,color,reference)
GETS: startx and starty : the starting point of the rectangle
endx and endy: the ending point of the rectangle
color: the color of the rectangle in HEX format
reference: a reference to the cllip to draw the rectangle in
RETS: the reference
rectanglea(startx, starty,endx,endy,color, alpha, reference)
GETS: startx and starty : the starting point of the rectangle
endx and endy: the ending point of the rectangle
color: the color of the rectangle in HEX format
alpha: the alpha value of the rectangle
reference: a reference to the cllip to draw the rectangle in
RETS: the reference
*/
function rectangle(x, y, ex, ey, col, ref) {
ref.lineStyle(1, 0x00000, 0);
ref.beginFill(col, 100);
ref.moveTo(x, y);
ref.lineTo(ex, y);
ref.lineTo(ex, ey);
ref.lineTo(x, ey);
ref.lineTo(x, y);
}
function rectangle(x, y, ex, ey, col, a, ref) {
ref.lineStyle(1, 0x00000, 0);
ref.beginFill(col, a);
ref.moveTo(x, y);
ref.lineTo(ex, y);
ref.lineTo(ex, ey);
ref.lineTo(x, ey);
ref.lineTo(x, y);
return ref;
}