# circ

## Parameters:

• x : the x coordinate of the circle center
• y : the y coordinate of the circle center
• r : the radius in pixel of the circle
• color: the index of the desired color in the current palette

## Description:

It draws a filled circle with center x and y of the radius requested. It uses the bresenham algorithm.

## Example

```-- title:  circ demo
-- author: Filippo
-- desc:   circ wiki demo
-- script: lua
-- pal: 0000001b2632493c2bf7e26bbe263344891a31a2f2ffffff005784a46422ffffffeb8931a3ce27b2dcefbfce72ffffff

--init balls
balls={}
d=1
for i=0,50 do
ball={x =math.random(10,220),
y =math.random(10,126),
dx=math.random(1,2)*d,
dy=math.random(1,2)*d,
r =math.random(6,12),
c =math.random(1,6)}
balls[i]=ball
d=d*-1
end

function TIC()
cls()
for k,b in pairs(balls) do
--move the ball
b.x=b.x+b.dx
b.y=b.y+b.dy
--check right/left walls
if b.x >= 240-b.r then
b.x=240-b.r-1 --constraints inside the wall
b.dx=-b.dx  --reverse direction
elseif b.x < b.r then
b.x=b.r
b.dx=-b.dx
end
--check bottom/top walls
if b.y >= 136-b.r then
b.y=136-b.r-1
b.dy=-b.dy
elseif b.y < b.r then
b.y=b.r
b.dy=-b.dy
end
--draw balls
circ(b.x,b.y,b.r,b.c)
circ(b.x+b.r/4,b.y-b.r/4,b.r/4,b.c+7)
end
end```

## Example 2

```-- title: circ example
-- desc: particular qualities 'circ'
-- script: lua

poke(0x3FF8,2)
cls(15)

SCREEN_WIDTH=240
SCREEN_HEIGHT=136
STEP=20