View.Set ("offscreenonly")
%VARIABLES
var mouseX, mouseY, button : int
var ballRad : int
var goalRad : int
var doomHoleX : int
var doomHoleY : int
var doomHoleRad : int
ballRad := 20
goalRad := 20
doomHoleRad := 20
doomHoleX := maxx div 2
doomHoleY := maxy div 2
%DRAW OBJECTS
procedure drawObjects
loop
cls
%doomhole
drawfilloval (doomHoleX, doomHoleY, doomHoleRad, doomHoleRad, black)
%red goal
drawfilloval (1 + goalRad, maxy - goalRad, goalRad, goalRad, red)
%blue goal
drawfilloval (maxx - goalRad, 1 + goalRad, doomHoleRad, doomHoleRad, blue)
View.Update
end loop
end drawObjects
%PLAYER BALL
procedure movePlayer
loop
Mouse.Where (mouseX, mouseY, button)
if button = 0 then
cls
drawfilloval (mouseX, mouseY, ballRad, ballRad, grey)
drawoval (mouseX, mouseY, ballRad, ballRad, black)
View.Update
else
cls
drawfilloval (mouseX, mouseY, ballRad, ballRad, grey)
drawoval (mouseX, mouseY, ballRad, ballRad, black)
View.Update
end if
end loop
end movePlayer
%HOLE OF DOOM COLLISION
%if you let balls touch the doomhole, you fail!
procedure doomHoleCol
loop
if mouseX + ballRad = doomHoleX + doomHoleRad then
if mouseY + ballRad = doomHoleY + doomHoleRad then
put "collision"
end if
end if
end loop
end doomHoleCol
%RUNTIME!
drawObjects
movePlayer
doomHoleCol
|