
-----------------------------------
thuyvy
Mon Jun 12, 2006 7:27 am

help me with brick game
-----------------------------------
hi everbody , plz help me with the brick game , i can not make the ball hit the paddle , & help me how to make the bricks

setscreen ("graphics:max;max,nobuttonbar")

% The "View.Update" program.
% Place some circles around the screen
const RADIUS : int := 10
var x, y, dx, dy, clr : array 1 .. 1 of int
var x1, y1, button : int 
var paddleHEIGHT: int:=5 
    x (1) := Rand.Int (RADIUS, maxx - RADIUS)
    y (1) := Rand.Int (RADIUS, maxy - RADIUS)
    dx (1) := Rand.Int (-3, 3)
    dy (1) := Rand.Int (-3, 3)
    clr (1) := Rand.Int (1, 15)


% Now, any drawing to the screen won't appear until a
% View.Update is given.
View.Set ("offscreenonly")
loop

 cls   % Clear the offscreen window
   mousewhere (x1, y1, button) 
drawfillbox (x1,20,x1+100,paddleHEIGHT,black) 

        if x (1) + dx (1) < RADIUS or
                x (1) + dx (1) > maxx - RADIUS then
            dx (1) := -dx (1)
        end if
        if y (1) + dy (1) < RADIUS or
                y (1) + dy (1) > maxy - RADIUS then
            dy (1) := -dy (1)
        end if
        x (1) := x (1) + dx (1)
        y (1) := y (1) + dy (1)
        
        
        
        Draw.FillOval (x (1), y (1), RADIUS, RADIUS, clr (1))

    % All the circles have been drawn.  Now update the screen.
    View.Update
         
    Time.Delay (7) 
exit when   y (1)= 0
end loop
