Computer Science Canada

Weird Effect with Drawfillpolygon

Author:  Paul [ Tue Jun 01, 2004 9:10 pm ]
Post subject:  Weird Effect with Drawfillpolygon

Hm... believe it or not, I just learned the command drawfillpolygon today! Laughing I messed with it, and here's what I got, try entering 100 to see the effect I mean. Smaller numbers aren't that outstanding
Note: try using numbers like 50, 100 or 200 or 300, but 500 will probably end up crashing ur environment.
recommended over 25 though lol Laughing
I think it gives it an almost 3D look, but more like glassy transparent.
code:

setscreen ("graphics: max;max;offscreenonly")
var number: int
put "How many sides?"
get number
colorback (black)
cls
var x : array 1 .. number of int
var y : array 1 .. number of int
var incx: array 1..number of int
var incy: array 1..number of int
for a: 1..number
randint (x(a), 100, maxx-100)
randint (y(a), 100, maxy-100)
incx(a):=3
incy(a):=3
end for
loop
for a: 1..number
x(a)+=incx(a)
y(a)+=incy(a)
end for
drawfillpolygon (x, y, number, 12)
View.Update
cls
for a: 1..number
if y(a)>=maxy or y(a) <= 0 then
incy(a):=-incy(a)
end if
if x(a)<=0 or x(a)>=maxx then
incx(a):=-incx(a)
end if
end for
end loop

Author:  rhomer [ Wed Jun 02, 2004 9:57 am ]
Post subject: 

That's pretty sweet, especially when you put a number in the low hundreds...

Author:  Tony [ Wed Jun 02, 2004 12:15 pm ]
Post subject: 

it looks even sweeter when you use
code:

incx(a):=Rand.Int(-5,5)
incy(a):=Rand.Int(-5,5)

instead Wink

Author:  Paul [ Wed Jun 02, 2004 1:06 pm ]
Post subject: 

for those of you who don't know:
code:

setscreen ("graphics: max;max;offscreenonly")
var number: int
put "How many sides?"
get number
colorback (black)
cls
var x : array 1 .. number of int
var y : array 1 .. number of int
var incx: array 1..number of int
var incy: array 1..number of int
for a: 1..number
randint (x(a), 100, maxx-100)
randint (y(a), 100, maxy-100)
incx(a):=Rand.Int(-5,5)
incy(a):=Rand.Int(-5,5) 
end for
loop
for a: 1..number
x(a)+=incx(a)
y(a)+=incy(a)
end for
drawfillpolygon (x, y, number, 12)
View.Update
cls
for a: 1..number
if y(a)>=maxy or y(a) <= 0 then
incy(a):=-incy(a)
end if
if x(a)<=0 or x(a)>=maxx then
incx(a):=-incx(a)
end if
end for
end loop

Author:  we64 [ Wed Jun 02, 2004 7:44 pm ]
Post subject: 

I don't see any difference.... it is pretty cool for either one... looks 3D...

Author:  SuperGenius [ Thu Jun 03, 2004 4:03 pm ]
Post subject: 

very interesting... I wish that our class had learned drawfill polygon.... anyways i was able to get 499 without crashing. I almost had a seizure though.

Author:  Paul [ Thu Jun 03, 2004 4:22 pm ]
Post subject: 

well shantz skipped it during graphics because we didn't know arrays... then I just remebered it existed when someone asked for a triangle.


: