http://www.youtube.com/watch?v=zjz-RzysjdY
global code:
- Code: Select all
void drawCircle(double xpos, double ypos, double r)
{
int xp, yp;
for(yp=floor(ypos)-ceil(r);yp<ceil(ypos)+ceil(r);yp++)
{
for(xp=floor(xpos)-ceil(r);xp<ceil(xpos)+ceil(r);xp++)
{
if(sqrt(pow(max(xpos, xp)-min(xpos, xp), 2)+pow(max(ypos, yp)-min(ypos, yp), 2))<=r) // This says put a pixel if it is within the circle, radius of r
{
putpixel(xp, yp); // Puts the actual pixels in
}
}
}
}
void SetLight(int X, int Y, double R)
{
draw_from("light", X, Y, R/light.width);
}
effect ative:
- Code: Select all
SetLight(player.xscreen, player.yscreen, 70);
SetLight(fire.xscreen, fire.yscreen, 50);