rendered paste bodyView.Set ("graphics:max,max")
var size : int := 50
var mx, my, mb : int
var ballx, bally : int := 200
var dirx, diry : int := 0
var ballSpeed : int := 1
dirx := ballSpeed
diry := ballSpeed
loop
mousewhere (mx, my, mb)
drawfillbox (mx - size, 0, mx + size, 50, black)
drawfillbox (mx - size - 1, 0, 0, 50, white)
drawfillbox (maxx, 0, mx + size + 1, 50, white)
drawfilloval (ballx, bally, 15, 15, white)
ballx += dirx
bally += diry
drawfilloval (ballx, bally, 15, 15, blue)
if ballx >= maxx then % right wall
dirx := - (dirx)
elsif bally >= maxy then % top wall
diry := - (diry)
elsif ballx <= 0 then % bottom
dirx := - (dirx)
elsif bally <= 0 then % left wall
diry := - (diry)
locate (1, 1)
put "lost ball"
ballx := 200
bally := 200
loop
mousewhere (mx, my, mb)
exit when mb = 1
end loop
end if
end loop