var runtime, count, starttime := 0
put "run for how many seconds?"
get runtime
runtime *= 1000
%Declaring variables
var colback, ballcol : int
var x := maxx div 2
var y := maxy div 2
%Procedure
proc circle
randint (ballcol, 5, 225)
drawfilloval (x, y, 20, 20, ballcol)
end circle
%Setting screen
setscreen ("nocursor")
%loop statement
loop
loop
randint (colback, 5, 50)
drawfillbox (0, 0, maxx, maxy, colback)
drawdot (1, -10, (Time.Elapsed mod 255) + 1)
count := Time.Elapsed div 255
if (255 * (count + 1)) > runtime then
if (255 * count) + whatdotcolor (1, -10) - 1 > runtime then
return
end if
end if
%Exiting from the program
exit when x < 10 or x > maxx - 10 or y < 10 or y > maxy - 10
circle
delay (50)
drawfilloval (x, y, 20, 20, colback)
randint (x, x - 15, x + 15)
randint (y, y - 15, y + 15)
end loop
x := maxx div 2
y := maxy div 2
end loop
|