setscreen ("offscreenonly")
var x, y : int := 200
var q, r : int := 400
r := 200
var num : int := 1
drawfillbox (q, r, q + 100, r + 100, black)
drawfillbox (100, 100, 300, 300, grey)
proc draw
drawfilloval (x, y, 30, 30, 12)
end draw
proc erase
drawfilloval (x, y, 30, 30, white)
end erase
loop
drawline (200, 200, x, y, white)
drawfillbox (100, 100, 300, 300, grey)
var a, b, press : int
mousewhere (a, b, press)
draw
if whatdotcolor (a, b) = 12 and press = 1 then
loop
mousewhere (a, b, press)
x := a
y := b
if x + 30 > 300 then
x := 300 - 30
end if
if x - 30 < 100 then
x := 100 + 30
end if
if y + 30 > 300 then
y := 300 - 30
end if
if y - 30 < 100 then
y := 100 + 30
end if
cls
if press = 1 then
q += round ((x - 200) / 1.5)
r += round ((y - 200) / 1.5)
if q < 0 then
q := 0
end if
if q + 100 > maxx then
q := maxx - 100
end if
if r < 0 then
r := 0
end if
if r + 100 > maxy then
r := maxy - 100
end if
end if
delay (100)
drawfillbox (q, r, q + 100, r + 100, black)
drawfillbox (100, 100, 300, 300, grey)
drawline (200, 200, x, y, black)
draw
View.Update
if press not= 1 then
erase
drawfillbox (100, 100, 300, 300, grey)
drawline (200, 200, x, y, white)
x := 200
y := 200
exit
end if
end loop
end if
drawline (200, 200, x, y, white)
draw
View.Update
end loop
|