var gx, gy : int %ball
 
var bchangex, bchangey : int := 5 %ball change
 
var bspeed : int
 
var bcolor : int
 
var bsize : int
 
var x1, x2, y1, y2 : int %paddle
 
var boxx, boxy, boxx2, boxy2: int %bricks
 
var chars : array char of boolean
 
var speed: int
 
 
speed := 5
 
x1 := 100
 
x2 := 10
 
gx := 10
 
gy := 10
 
y1 := 10
 
y2 := 20
 
 
 
setscreen ("graphics:max;max,nobuttonbar,title:D:")
 
 
View.Set ("offscreenonly")
 
 
locate (23, 30)
 
put "Before starting the program, make sure your dimensions are at 1024x728."
 
delay (2000)
 
 
colorback (31)
 
cls
 
 
 
 
loop
 
    
 
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%paddle
 
 
    Input.KeyDown (chars)
 
    if chars (KEY_RIGHT_ARROW) then
 
        x1 := x1 + 10
 
        x2 := x2 + 10
 
        if x1 > 1000 then
 
            x1 := 999
 
        end if
 
        if x2 > 900 then
 
            x2 := 899
 
        end if
 
        View.Update
 
 
        cls
 
    end if
 
    if chars (KEY_LEFT_ARROW) then
 
        x1 := x1 - 10
 
        x2 := x2 - 10
 
        if x1 < 100 then
 
            x1 := 90
 
        end if
 
        if x2 < 1 then
 
            x2 := 1
 
        end if
 
        View.Update
 
 
        cls
 
    end if
 
 
    drawfillbox (x1, y1, x2, y2, 78)   
 
 
    bcolor := red
 
    bsize := 7
 
    
 
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%ball and ball collision
 
    
 
    Draw.Oval (gx, gy, bsize, bsize, bcolor)
 
    View.Update
 
 
    if gx <= 0 then
 
        bchangex := 1
 
    elsif gy <= 1 then
 
        bchangey := 1
 
    end if
 
 
    if gx >= maxx then
 
        bchangex := -1
 
    elsif gy >= maxy then
 
        bchangey := -1
 
    end if
 
 
    gx += bchangex
 
    gy += bchangey
 
 
    cls
 
    
 
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%paddle collision
 
    
 
    
 
    if gx + bsize > x1 - x2 and gx - bsize < x1 + x2 and gy + bsize > y1 - y2 and gy - bsize < y1 +
 
            y2 then
 
 
        bchangex := bchangex * +1
 
        bchangey := bchangey * -1
 
 
    end if
 
    
 
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%bricks and brick collision
 
 
    boxx := 100
 
    boxy := 150
 
    boxx2 := 300
 
    boxy2 := 200
 
 
    Draw.Box (boxx, boxy, boxx2, boxy2, black)
 
 
        if bchangex > 0 then 
 
            if whatdotcolor (gx + bchangex + bsize, gy) = black then 
 
                Draw.Box (boxx, boxy, boxx2, boxy2, white)    
 
                bchangex := -bchangex  
 
            end if 
 
        else 
 
            if whatdotcolor (gx + bchangex - bsize, gy) = black then 
 
                Draw.Box (boxx, boxy, boxx2, boxy2, white)
 
                bchangex := +bchangex 
 
            end if 
 
        end if 
 
 
        if bchangey > 0 then 
 
            if whatdotcolor (gx, gy + bchangey + bsize) = black then 
 
                Draw.Box (boxx, boxy, boxx2, boxy2, white)    
 
                bchangey := -bchangey 
 
            end if 
 
        else 
 
            if whatdotcolor (gx, gy + bchangey - bsize) = black then   
 
                Draw.Box (boxx, boxy, boxx2, boxy2, white)    
 
                bchangey := +bchangey  
 
            end if 
 
        end if  |