var a, b, x, y : int := 1
var a1, b1, x1, y1 : int := 1
var radius, xx, yy : int
var c, cc : int := 104
var ch : string (1)
randomize
cc := 1
proc abc
loop
% randint (c, 20, 103)
drawline (x, y, x1, y1, black)
xx := floor ((x1 + x) / 2)
yy := floor ((y1 + y) / 2)
radius := floor (sqrt ((x1 - x) ** 2 + (y1 - y) ** 2))
drawoval (xx, yy, radius, radius, c) % <---- try change colour here
if x > maxx or 1 > x then
a := (a1) * -1
end if
if x1 > maxx or 1 > x1 then
a1 := (a1) * -1
end if
if y > maxy or 1 > y then
b := (b) * -1
end if
if y1 > maxy or 1 > y1 then
b1 := (b1) * -1
end if
delay (5)
drawline (x, y, x1, y1, white)
x := x + a
x1 := x1 + a1
y := y + b
y1 := y1 + b1
c := c + cc
if c > 254 then
cc := -1
end if
if c < 104 then
cc := 1
end if
exit when hasch
end loop
getch (ch)
return
end abc
loop
put "press anykey to start a new one"
delay (500)
randint (x, 1, maxx)
randint (y, 1, maxy)
randint (x1, 1, maxx)
randint (y1, 1, maxy)
abc
delay (500)
cls
end loop
|