
-----------------------------------
EmptyM
Mon Apr 16, 2007 9:56 am

Grade 10 ISU -- Brick game and Paint
-----------------------------------

%%%%%%%%%%%%%%%%%%%%% BRICK GAME:
setscreen ("Graphics:max;max")
Mouse.ButtonChoose ("multibutton")

var font1, font2, font3, z, watch, t, y1, x1, y2, x2, y3, x3, y4, x4, r1, colours, erase,
    xinc, yinc, btn1, btn2, left, middle, right, lives, slowmotion, brickcolour1,
    brickcolour2, brickcolour3, brickcolour4, brickcolour5, brickcolour6, brickcolour7,
    brickcolour8, brickcolour9, brickcolour10, brickcolour11, brickcolour12, brickcolour13,
    brickcolour14, speed, level, score, ballwarp : int
    var x, y, button : int
%1 = red, 2 = green
var playagain : string
const midx := maxx div 2
const midy := maxy div 2
var controls : array char of boolean
font1 := Font.New ("Arial:30")
font2 := Font.New ("Times New Roman:14")
slowmotion := 5
speed := 10
level := 1
playagain := "Y"
score := 0
ballwarp := 3
process powers

    loop
        
        Mouse.Where (x, y, button)
        left := button mod 10           % left = 0 or 1
        middle := (button - left) mod 100   % middle = 0 or 10
        right := button - middle - left % right = 0 or 100
        if left = 1 then
            y4 := 50
            if slowmotion not= 0 then
                slowmotion := slowmotion - 1
            end if
            if slowmotion not= 0 then
                loop


                    y4 := y4 + 2
                    delay (5)

                    View.Update

                    exit when y4 >= maxy + 10

                end loop
            end if
        end if
        if middle = 10 then
            if ballwarp not= 0 then
                drawfilloval (x3, y3, r1, r1, 255)
                x2 := 70
                x3 := 50
                y3 := 50
                xinc := 4
                yinc := 4
                delay (100)
                ballwarp := ballwarp - 1
            end if
        end if
        if right = 100 then
            if ballwarp not= 0 then
                drawfilloval (x3, y3, r1, r1, 255)
                x2 := 70
                x3 := 50
                y3 := 50
                xinc := 4
                yinc := 4
                delay (100)
                ballwarp := ballwarp - 1
            end if
        end if
    end loop
end powers


process ballbouncing
    lives := 5
    cls

    loop

        drawfill (1, 1, 255, 1)


        if level = 1 or level = 2 then
            brickcolour1 := 1
            brickcolour2 := 1
            brickcolour3 := 1
            brickcolour4 := 1
            brickcolour5 := 1
            brickcolour6 := 1
            brickcolour7 := 1
            brickcolour8 := 1
            brickcolour9 := 1
            brickcolour10 := 1
            brickcolour11 := 1
            brickcolour12 := 1
            brickcolour13 := 1
            brickcolour14 := 1
        end if
        if level >= 3 and level  5 and level < 10 then
            randint (brickcolour1, 1, 3)
            randint (brickcolour2, 1, 3)
            randint (brickcolour3, 1, 3)
            randint (brickcolour4, 1, 3)
            randint (brickcolour5, 1, 3)
            randint (brickcolour6, 1, 3)
            randint (brickcolour7, 1, 3)
            randint (brickcolour8, 1, 3)
            randint (brickcolour9, 1, 3)
            randint (brickcolour10, 1, 3)
            randint (brickcolour11, 1, 3)
            randint (brickcolour12, 1, 3)
            randint (brickcolour13, 1, 3)
            randint (brickcolour14, 1, 3)
            if brickcolour1 = 3 then
                brickcolour1 := 2
            end if
            if brickcolour2 = 3 then
                brickcolour2 := 2
            end if
            if brickcolour3 = 3 then
                brickcolour3 := 2
            end if
            if brickcolour4 = 3 then
                brickcolour4 := 2
            end if
            if brickcolour5 = 3 then
                brickcolour5 := 2
            end if
            if brickcolour6 = 3 then
                brickcolour6 := 2
            end if
            if brickcolour7 = 3 then
                brickcolour7 := 2
            end if
            if brickcolour8 = 3 then
                brickcolour8 := 2
            end if
            if brickcolour9 = 3 then
                brickcolour9 := 2
            end if
            if brickcolour10 = 3 then
                brickcolour10 := 2
            end if
            if brickcolour11 = 3 then
                brickcolour11 := 2
            end if
            if brickcolour12 = 3 then
                brickcolour12 := 2
            end if
            if brickcolour13 = 3 then
                brickcolour13 := 2
            end if
            if brickcolour14 = 3 then
                brickcolour14 := 2
            end if
        end if
        if level > 10 then
            brickcolour1 := 2
            brickcolour2 := 2
            brickcolour3 := 2
            brickcolour4 := 2
            brickcolour5 := 2
            brickcolour6 := 2
            brickcolour7 := 2
            brickcolour8 := 2
            brickcolour9 := 2
            brickcolour10 := 2
            brickcolour11 := 2
            brickcolour12 := 2
            brickcolour13 := 2
            brickcolour14 := 2
        end if

        loop

            x1 := 10
            y1 := 10
            x2 := 70
            y2 := 20
            x3 := 50
            y3 := 50
            xinc := 4
            yinc := 4
            loop



                if brickcolour1 = 2 then
                    drawbox (90, 470, 190, 500, 10)
                    drawbox (100, 480, 180, 490, 10)
                    drawfill (95, 485, 2, 10)
                    drawline (90, 500, 100, 490, 10)
                    drawline (190, 470, 170, 490, 10)
                    drawfill (185, 485, 72, 10)
                    drawline (190, 500, 180, 490, 10)
                    drawline (90, 470, 110, 490, 10)
                    drawfillbox (101, 481, 179, 489, 10)
                end if

                if brickcolour2 = 2 then
                    drawbox (200, 470, 300, 500, 10)
                    drawbox (210, 480, 290, 490, 10)
                    drawfill (205, 485, 2, 10)
                    drawline (200, 500, 210, 490, 10)
                    drawline (300, 470, 280, 490, 10)
                    drawfill (295, 485, 72, 10)
                    drawline (300, 500, 290, 490, 10)
                    drawline (200, 470, 220, 490, 10)
                    drawfillbox (211, 481, 289, 489, 10)
                end if

                if brickcolour3 = 2 then
                    drawbox (310, 470, 410, 500, 10)
                    drawbox (320, 480, 400, 490, 10)
                    drawfill (315, 485, 2, 10)
                    drawline (310, 500, 320, 490, 10)
                    drawline (410, 470, 390, 490, 10)
                    drawfill (405, 485, 72, 10)
                    drawline (410, 500, 400, 490, 10)
                    drawline (310, 470, 330, 490, 10)
                    drawfillbox (321, 481, 399, 489, 10)
                end if

                if brickcolour4 = 2 then
                    drawbox (420, 470, 520, 500, 10)
                    drawbox (430, 480, 510, 490, 10)
                    drawfill (425, 485, 2, 10)
                    drawline (420, 500, 430, 490, 10)
                    drawline (520, 470, 500, 490, 10)
                    drawfill (515, 485, 72, 10)
                    drawline (520, 500, 510, 490, 10)
                    drawline (420, 470, 440, 490, 10)
                    drawfillbox (431, 481, 509, 489, 10)
                end if

                if brickcolour5 = 2 then
                    drawbox (530, 470, 630, 500, 10)
                    drawbox (540, 480, 620, 490, 10)
                    drawfill (535, 485, 2, 10)
                    drawline (530, 500, 540, 490, 10)
                    drawline (630, 470, 610, 490, 10)
                    drawfill (625, 485, 72, 10)
                    drawline (630, 500, 620, 490, 10)
                    drawline (530, 470, 550, 490, 10)
                    drawfillbox (541, 481, 619, 489, 10)
                end if

                if brickcolour6 = 2 then
                    drawbox (640, 470, 740, 500, 10)
                    drawbox (650, 480, 730, 490, 10)
                    drawfill (645, 485, 2, 10)
                    drawline (640, 500, 650, 490, 10)
                    drawline (740, 470, 720, 490, 10)
                    drawfill (735, 485, 72, 10)
                    drawline (740, 500, 730, 490, 10)
                    drawline (640, 470, 660, 490, 10)
                    drawfillbox (651, 481, 729, 489, 10)
                end if

                if brickcolour7 = 2 then
                    drawbox (750, 470, 850, 500, 10)
                    drawbox (760, 480, 840, 490, 10)
                    drawfill (755, 485, 2, 10)
                    drawline (750, 500, 760, 490, 10)
                    drawline (850, 470, 830, 490, 10)
                    drawfill (845, 485, 72, 10)
                    drawline (850, 500, 840, 490, 10)
                    drawline (750, 470, 770, 490, 10)
                    drawfillbox (761, 481, 839, 489, 10)
                end if



                if brickcolour8 = 2 then
                    drawbox (90, 570, 190, 600, 10)
                    drawbox (100, 580, 180, 590, 10)
                    drawfill (95, 585, 2, 10)
                    drawline (90, 600, 100, 590, 10)
                    drawline (190, 570, 170, 590, 10)
                    drawfill (185, 585, 72, 10)
                    drawline (190, 600, 180, 590, 10)
                    drawline (90, 570, 110, 590, 10)
                    drawfillbox (101, 581, 179, 589, 10)
                end if

                if brickcolour9 = 2 then
                    drawbox (200, 570, 300, 600, 10)
                    drawbox (210, 580, 290, 590, 10)
                    drawfill (205, 585, 2, 10)
                    drawline (200, 600, 210, 590, 10)
                    drawline (300, 570, 280, 590, 10)
                    drawfill (295, 585, 72, 10)
                    drawline (300, 600, 290, 590, 10)
                    drawline (200, 570, 220, 590, 10)
                    drawfillbox (211, 581, 289, 589, 10)
                end if

                if brickcolour10 = 2 then
                    drawbox (310, 570, 410, 600, 10)
                    drawbox (320, 580, 400, 590, 10)
                    drawfill (315, 585, 2, 10)
                    drawline (310, 600, 320, 590, 10)
                    drawline (410, 570, 390, 590, 10)
                    drawfill (405, 585, 72, 10)
                    drawline (410, 600, 400, 590, 10)
                    drawline (310, 570, 330, 590, 10)
                    drawfillbox (321, 581, 399, 589, 10)
                end if

                if brickcolour11 = 2 then
                    drawbox (420, 570, 520, 600, 10)
                    drawbox (430, 580, 510, 590, 10)
                    drawfill (425, 585, 2, 10)
                    drawline (420, 600, 430, 590, 10)
                    drawline (520, 570, 500, 590, 10)
                    drawfill (515, 585, 72, 10)
                    drawline (520, 600, 510, 590, 10)
                    drawline (420, 570, 440, 590, 10)
                    drawfillbox (431, 581, 509, 589, 10)
                end if

                if brickcolour12 = 2 then
                    drawbox (530, 570, 630, 600, 10)
                    drawbox (540, 580, 620, 590, 10)
                    drawfill (535, 585, 2, 10)
                    drawline (530, 600, 540, 590, 10)
                    drawline (630, 570, 610, 590, 10)
                    drawfill (625, 585, 72, 10)
                    drawline (630, 600, 620, 590, 10)
                    drawline (530, 570, 550, 590, 10)
                    drawfillbox (541, 581, 619, 589, 10)
                end if

                if brickcolour13 = 2 then
                    drawbox (640, 570, 740, 600, 10)
                    drawbox (650, 580, 730, 590, 10)
                    drawfill (645, 585, 2, 10)
                    drawline (640, 600, 650, 590, 10)
                    drawline (740, 570, 720, 590, 10)
                    drawfill (735, 585, 72, 10)
                    drawline (740, 600, 730, 590, 10)
                    drawline (640, 570, 660, 590, 10)
                    drawfillbox (651, 581, 729, 589, 10)
                end if

                if brickcolour14 = 2 then
                    drawbox (750, 570, 850, 600, 10)
                    drawbox (760, 580, 840, 590, 10)
                    drawfill (755, 585, 2, 10)
                    drawline (750, 600, 760, 590, 10)
                    drawline (850, 570, 830, 590, 10)
                    drawfill (845, 585, 72, 10)
                    drawline (850, 600, 840, 590, 10)
                    drawline (750, 570, 770, 590, 10)
                    drawfillbox (761, 581, 839, 589, 10)
                end if

                if brickcolour1 = 1 then
                    drawbox (90, 470, 190, 500, 12)
                    drawbox (100, 480, 180, 490, 12)
                    drawfill (95, 485, 4, 12)
                    drawline (90, 500, 100, 490, 12)
                    drawline (190, 470, 170, 490, 12)
                    drawfill (185, 485, 64, 12)
                    drawline (190, 500, 180, 490, 12)
                    drawline (90, 470, 110, 490, 12)
                    drawfillbox (101, 481, 179, 489, 12)
                end if
                if brickcolour2 = 1 then
                    drawbox (200, 470, 300, 500, 12)
                    drawbox (210, 480, 290, 490, 12)
                    drawfill (205, 485, 4, 12)
                    drawline (200, 500, 210, 490, 12)
                    drawline (300, 470, 280, 490, 12)
                    drawfill (295, 485, 64, 12)
                    drawline (300, 500, 290, 490, 12)
                    drawline (200, 470, 220, 490, 12)
                    drawfillbox (211, 481, 289, 489, 12)
                end if

                if brickcolour3 = 1 then
                    drawbox (310, 470, 410, 500, 12)
                    drawbox (320, 480, 400, 490, 12)
                    drawfill (315, 485, 4, 12)
                    drawline (310, 500, 320, 490, 12)
                    drawline (410, 470, 390, 490, 12)
                    drawfill (405, 485, 64, 12)
                    drawline (410, 500, 400, 490, 12)
                    drawline (310, 470, 330, 490, 12)
                    drawfillbox (321, 481, 399, 489, 12)
                end if

                if brickcolour4 = 1 then
                    drawbox (420, 470, 520, 500, 12)
                    drawbox (430, 480, 510, 490, 12)
                    drawfill (425, 485, 4, 12)
                    drawline (420, 500, 430, 490, 12)
                    drawline (520, 470, 500, 490, 12)
                    drawfill (515, 485, 64, 12)
                    drawline (520, 500, 510, 490, 12)
                    drawline (420, 470, 440, 490, 12)
                    drawfillbox (431, 481, 509, 489, 12)
                end if

                if brickcolour5 = 1 then
                    drawbox (530, 470, 630, 500, 12)
                    drawbox (540, 480, 620, 490, 12)
                    drawfill (535, 485, 4, 12)
                    drawline (530, 500, 540, 490, 12)
                    drawline (630, 470, 610, 490, 12)
                    drawfill (625, 485, 64, 12)
                    drawline (630, 500, 620, 490, 12)
                    drawline (530, 470, 550, 490, 12)
                    drawfillbox (541, 481, 619, 489, 12)
                end if

                if brickcolour6 = 1 then
                    drawbox (640, 470, 740, 500, 12)
                    drawbox (650, 480, 730, 490, 12)
                    drawfill (645, 485, 4, 12)
                    drawline (640, 500, 650, 490, 12)
                    drawline (740, 470, 720, 490, 12)
                    drawfill (735, 485, 64, 12)
                    drawline (740, 500, 730, 490, 12)
                    drawline (640, 470, 660, 490, 12)
                    drawfillbox (651, 481, 729, 489, 12)
                end if

                if brickcolour7 = 1 then
                    drawbox (750, 470, 850, 500, 12)
                    drawbox (760, 480, 840, 490, 12)
                    drawfill (755, 485, 4, 12)
                    drawline (750, 500, 760, 490, 12)
                    drawline (850, 470, 830, 490, 12)
                    drawfill (845, 485, 64, 12)
                    drawline (850, 500, 840, 490, 12)
                    drawline (750, 470, 770, 490, 12)
                    drawfillbox (761, 481, 839, 489, 12)
                end if

                if brickcolour8 = 1 then
                    drawbox (90, 570, 190, 600, 12)
                    drawbox (100, 580, 180, 590, 12)
                    drawfill (95, 585, 4, 12)
                    drawline (90, 600, 100, 590, 12)
                    drawline (190, 570, 170, 590, 12)
                    drawfill (185, 585, 64, 12)
                    drawline (190, 600, 180, 590, 12)
                    drawline (90, 570, 110, 590, 12)
                    drawfillbox (101, 581, 179, 589, 12)
                end if

                if brickcolour9 = 1 then
                    drawbox (200, 570, 300, 600, 12)
                    drawbox (210, 580, 290, 590, 12)
                    drawfill (205, 585, 4, 12)
                    drawline (200, 600, 210, 590, 12)
                    drawline (300, 570, 280, 590, 12)
                    drawfill (295, 585, 64, 12)
                    drawline (300, 600, 290, 590, 12)
                    drawline (200, 570, 220, 590, 12)
                    drawfillbox (211, 581, 289, 589, 12)
                end if

                if brickcolour10 = 1 then
                    drawbox (310, 570, 410, 600, 12)
                    drawbox (320, 580, 400, 590, 12)
                    drawfill (315, 585, 4, 12)
                    drawline (310, 600, 320, 590, 12)
                    drawline (410, 570, 390, 590, 12)
                    drawfill (405, 585, 64, 12)
                    drawline (410, 600, 400, 590, 12)
                    drawline (310, 570, 330, 590, 12)
                    drawfillbox (321, 581, 399, 589, 12)
                end if

                if brickcolour11 = 1 then
                    drawbox (420, 570, 520, 600, 12)
                    drawbox (430, 580, 510, 590, 12)
                    drawfill (425, 585, 4, 12)
                    drawline (420, 600, 430, 590, 12)
                    drawline (520, 570, 500, 590, 12)
                    drawfill (515, 585, 64, 12)
                    drawline (520, 600, 510, 590, 12)
                    drawline (420, 570, 440, 590, 12)
                    drawfillbox (431, 581, 509, 589, 12)
                end if

                if brickcolour12 = 1 then
                    drawbox (530, 570, 630, 600, 12)
                    drawbox (540, 580, 620, 590, 12)
                    drawfill (535, 585, 4, 12)
                    drawline (530, 600, 540, 590, 12)
                    drawline (630, 570, 610, 590, 12)
                    drawfill (625, 585, 64, 12)
                    drawline (630, 600, 620, 590, 12)
                    drawline (530, 570, 550, 590, 12)
                    drawfillbox (541, 581, 619, 589, 12)
                end if

                if brickcolour13 = 1 then
                    drawbox (640, 570, 740, 600, 12)
                    drawbox (650, 580, 730, 590, 12)
                    drawfill (645, 585, 4, 12)
                    drawline (640, 600, 650, 590, 12)
                    drawline (740, 570, 720, 590, 12)
                    drawfill (735, 585, 64, 12)
                    drawline (740, 600, 730, 590, 12)
                    drawline (640, 570, 660, 590, 12)
                    drawfillbox (651, 581, 729, 589, 12)
                end if

                if brickcolour14 = 1 then
                    drawbox (750, 570, 850, 600, 12)
                    drawbox (760, 580, 840, 590, 12)
                    drawfill (755, 585, 4, 12)
                    drawline (750, 600, 760, 590, 12)
                    drawline (850, 570, 830, 590, 12)
                    drawfill (845, 585, 64, 12)
                    drawline (850, 600, 840, 590, 12)
                    drawline (750, 570, 770, 590, 12)
                    drawfillbox (761, 581, 839, 589, 12)
                end if

                drawfilloval (x3, y3, r1, r1, 255)
                x3 := x3 + xinc
                y3 := y3 + yinc
                drawfilloval (x3, y3, r1, r1, 0)
                delay (speed)

                if x3 + r1 >= maxx then
                    xinc := -xinc
                elsif x3 - r1 = maxy then
                    yinc := -yinc
                elsif y3 - r1 = midx - 200 and x = midy - 133 and y = midx + 100 and x = midy - 133 and y = 0 and x1  0 then
                        delay (50)
                        r1 := r1 - 1
                        crsize := r1

                        drawfillbox (maxx - 200, 0, maxx, 100, 255)
                        drawfillbox (maxx - 190, 10, maxx - 10, 90, 0)
                        Font.Draw ("Circle Size :", maxx - 180, 60, font2, 255)
                        Font.Draw ("Square Size :", maxx - 180, 30, font2, 255)

                        Font.Draw (intstr (crsize), maxx - 50, 60, font2, 255)
                        Font.Draw (intstr (sqsize), maxx - 50, 30, font2, 255)
                    end if
                end if
            end if
            if sqcir = "square" then
                drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                if controls (KEY_UP_ARROW) and y1 + yinc = 0 then
                    y1 := y1 - xinc
                    y2 := y2 - xinc
                    drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                end if
                if controls (KEY_RIGHT_ARROW) and x1 + yinc = 0 then
                    x1 := x1 - xinc
                    x2 := x2 - xinc
                    drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                end if
                if controls ('+') then
                    yinc := yinc + 1
                    yinc := yinc + 1

                    sqsize := yinc
                    drawfillbox (maxx - 200, 0, maxx, 100, 255)
                    drawfillbox (maxx - 190, 10, maxx - 10, 90, 0)
                    Font.Draw ("Circle Size :", maxx - 180, 60, font2, 255)
                    Font.Draw ("Square Size :", maxx - 180, 30, font2, 255)

                    Font.Draw (intstr (crsize), maxx - 50, 60, font2, 255)
                    Font.Draw (intstr (sqsize), maxx - 50, 30, font2, 255)

                    delay (50)
                    drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                end if
                if controls ('-') then
                    if x1 + yinc - x1 > 0 then
                        yinc := yinc - 1
                        yinc := yinc - 1
                        delay (50)

                        sqsize := yinc
                        drawfillbox (maxx - 200, 0, maxx, 100, 255)
                        drawfillbox (maxx - 190, 10, maxx - 10, 90, 0)
                        Font.Draw ("Circle Size :", maxx - 180, 60, font2, 255)
                        Font.Draw ("Square Size :", maxx - 180, 30, font2, 255)

                        Font.Draw (intstr (crsize), maxx - 50, 60, font2, 255)
                        Font.Draw (intstr (sqsize), maxx - 50, 30, font2, 255)
                    end if
                end if
            end if
            if controls ('5') then
                colours := 12
                if sqcir = "circle" then
                    drawfilloval (x1, y1, r1, r1, colours)
                else
                    drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                end if
            end if
            if controls ('4') then
                colours := 14
                if sqcir = "circle" then
                    drawfilloval (x1, y1, r1, r1, colours)
                else
                    drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                end if
            end if
            if controls ('3') then
                colours := 47
                if sqcir = "circle" then
                    drawfilloval (x1, y1, r1, r1, colours)
                else
                    drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                end if
            end if
            if controls ('2') then
                colours := 9
                if sqcir = "circle" then
                    drawfilloval (x1, y1, r1, r1, colours)
                else
                    drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                end if
            end if
            if controls ('1') then
                colours := 255
                if sqcir = "circle" then
                    drawfilloval (x1, y1, r1, r1, colours)
                else
                    drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                end if
            end if
            if controls ('0') then
                colours := 0
                if sqcir = "circle" then
                    drawfilloval (x1, y1, r1, r1, colours)
                else
                    drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                end if
            end if
            if controls ('9') then
                colours := 13
                if sqcir = "circle" then
                    drawfilloval (x1, y1, r1, r1, colours)
                else
                    drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                end if
            end if
            if controls ('8') then
                colours := 42
                if sqcir = "circle" then
                    drawfilloval (x1, y1, r1, r1, colours)
                else
                    drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                end if
            end if
            if controls ('7') then
                colours := 15
                if sqcir = "circle" then
                    drawfilloval (x1, y1, r1, r1, colours)
                else
                    drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                end if
            end if
            if controls ('6') then
                colours := 114
                if sqcir = "circle" then
                    drawfilloval (x1, y1, r1, r1, colours)
                else
                    drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours)
                end if
            end if
            if controls (KEY_CTRL) and controls ('n') then
                cls
            end if
            if Mouse.ButtonMoved ("down") then
                Mouse.ButtonWait ("down", x1, y1, btn1, btn2)
                Text.Locate (1, 1)
                Mouse.Where (x1, y1, btn1)
                left := btn1 mod 10     % left = 0 or 1
                middle := (btn1 - left) mod 100                     % middle = 0 or 10
                right := btn1 - middle - left     % right = 0 or 100
                if left = 1 then
                    sqcir := "circle"
                    drawfilloval (x1, y1, r1, r1, colours)
                end if
                if middle = 10 then
                    put "middle button down"
                end if
                if right = 100 then
                    sqcir := "square"
                end if
            end if
            if controls (KEY_ESC) then
                watch := 4
            end if
            exit when watch = 4
        end loop


-----------------------------------
Clayton
Mon Apr 16, 2007 10:25 am

RE:Grade 10 ISU -- Brick game and Paint
-----------------------------------
I'm seeing a lot of issues with this code. The first and most blatantly obvious is the huge lack of arrays. Having brickcolour1-14 is not very appealing is it? Also, your use of processes is entirely unneeded. This very same program could be done without processes and makes a lot more sense logically. I suggest you take a good look at the arrays tutorial in the Turing Walkthrough, as well as the Procedures and Functions tutorial.

-----------------------------------
CodeMonkey2000
Mon Apr 16, 2007 7:13 pm

RE:Grade 10 ISU -- Brick game and Paint
-----------------------------------
Holy smokes!! So inefficient... Make my brain hurt... Oh well, for what it is, it looks like you put a lot of effort into it. Pretty impressive the way you did it. There is A LOT of room for improvement, as Freakman just pointed out.

-----------------------------------
EmptyM
Mon Apr 16, 2007 11:19 pm

Re: Grade 10 ISU -- Brick game and Paint
-----------------------------------
Thanks for link to TUring tutotial. I never used arrays becuase... i never learned what they were. I understand functions stuff, looks pretty straightforward. I'll change that in my code, but i dont understand how i would use arrays for brickcolour1-14..
My teacher told me to use processes, so i did that. I found it easier...

-----------------------------------
Carey
Tue Apr 17, 2007 8:46 am

Re: Grade 10 ISU -- Brick game and Paint
-----------------------------------
An array is basicly a whole bunch of variables with one name. A number in brackets after the array name is what makes one element different from the others. so instead of having:

var brickcolour1, brickcolour2, brickcolour3, brickcolour4, brickcolour5, brickcolour6, brickcolour7, brickcolour8, brickcolour9, brickcolour10, brickcolour11, brickcolour12, brickcolour13, brickcolour14 :int


You would have:

var brickcolour : array 1..14 of int


This also makes it easier to set all the values to what you want like so:

for i : 1..14
    brickcolour (i) := Rand.Int(1, 2)
    %or randint (brickcolour (i), 1, 2)
end for


Arrays are also way more efficiant on the system than lots of variables.

Hope this helps.

This is probly already in the [url=http://www.compsci.ca/v3/viewtopic.php?t=8808]Turing Walthrough, but i had fun writing this so........ :D

-----------------------------------
EmptyM
Tue Apr 17, 2007 4:37 pm

Re: Grade 10 ISU -- Brick game and Paint
-----------------------------------
Thnx for help.. Can people try out the game and the paint and give anyother ideas of what i could do next. I want to see if i can make the game itself/ or paint, better.

-----------------------------------
Drakain Zeil
Wed Apr 18, 2007 10:49 pm

RE:Grade 10 ISU -- Brick game and Paint
-----------------------------------
I'm going to go out on a limb here, and judge your code skills based on what I've seen so far.
You didn't use an array, so you probably didn't know about it to begin with. This means you're probably really new to programming. So I'm going to guess you should really take a step back and think about doing something easier than brickout or paint.

I suggest doing pong. Not that I don't believe you cannot do these programs, just that you'll be hard pressed come the ISU due date.

A more experianced programmer can code pong in less than 100 lines, under an hour. I'd estimate that's a good pretty project for a novice. It's an excelent place to start learning more advanced topics off of as well! If I was a grade 10 programming teacher (based on my experience in my grade 10 programming class), I would accept it as 'hard enough.'

Paint, and brick out are not easy/good places to start off.

Brick out requires more object-oriented collision detection (if you didn't know arrays, you probably don't know OOP design and theory, and therefore have a *really* hard time doing it -- it would take you ten times as much code to do it without OOP design theory).

Paint requires all sorts of things, such as saving files, brushes, drawing shapes, colours, and anything else you can think of. It's probably more complicated than brick.

Pong on the other hand, is a much simpler system. You could have a working system up and running far before the due date, and spend time making personal creative improvements. More balls (with a bit of OOP, you can have as many balls as you want, or paddles... with a lot of OOP you could have a second game of pong AS the pong ball, but let's not worry about that :) ), coloured balls, chaning speeds, mis-shapen paddles, menus for compuer or human opponents... random obsticles in the game, it's up to you really.

But then again, it's all really up to you, keep doing brick and paint if you feel like it. This is just my advice.

-----------------------------------
EmptyM
Thu Apr 19, 2007 8:59 am

Re: Grade 10 ISU -- Brick game and Paint
-----------------------------------
I've finished both. i just want people to it  try out. The paint is a diff kinda paint where you control the brush with keys. Instructions of brick game and paint can be seen when u run it.
