Turing: |
%%%%%%%%%%%%%%%%%%%%% 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 then
randint (brickcolour1, 1, 2)
randint (brickcolour2, 1, 2)
randint (brickcolour3, 1, 2)
randint (brickcolour4, 1, 2)
randint (brickcolour5, 1, 2)
randint (brickcolour6, 1, 2)
randint (brickcolour7, 1, 2)
randint (brickcolour8, 1, 2)
randint (brickcolour9, 1, 2)
randint (brickcolour10, 1, 2)
randint (brickcolour11, 1, 2)
randint (brickcolour12, 1, 2)
randint (brickcolour13, 1, 2)
randint (brickcolour14, 1, 2)
end if
if 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 <= 0 then
xinc := -xinc
elsif y3 + r1 >= maxy then
yinc := -yinc
elsif y3 - r1 <= 0 then
Font.Draw ("You died", 50, midy + 20, font1, 12)
delay (1000)
lives := lives - 1
drawfilloval (x3, y3, r1, r1, 255)
drawfillbox (50, midy + 20, 210, midy + 50, 255)
end if
if whatdotcolor (x3 + r1 + xinc, y3 + r1 + yinc ) = 9 or whatdotcolour (x3 - r1 + xinc, y3 - r1 + yinc ) = 9 then
yinc := -yinc
end if
exit when y3 - r1 <= 0
if (whatdotcolor (x3 + r1 + xinc, y3 + r1 + yinc ) = 12 or whatdotcolour (x3 - r1 + xinc, y3 - r1 + yinc ) = 12 or whatdotcolour (x3 - r1 + xinc, y3 + r1 + yinc ) = 12 or
whatdotcolour (x3 +
r1 + xinc, y3 - r1 + yinc ) = 12) or (whatdotcolor (x3 + r1 + xinc, y3 + r1 + yinc ) = 10 or whatdotcolour (x3 - r1 + xinc, y3 - r1 + yinc ) = 10 or whatdotcolour (x3 - r1 +
xinc, y3
+ r1 + yinc ) = 10 or whatdotcolour (x3 +
r1 + xinc, y3 - r1 + yinc ) = 10) then
if x3 >= 90 and x3 <= 190 and y3 >= 470 and y3 <= 500 then
if brickcolour1 = 1 then
drawfillbox (90, 470, 190, 500, 255)
brickcolour1 := 0
score := score + 15
elsif brickcolour1 = 2 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)
brickcolour1 := 1
score := score + 10
end if
yinc := -yinc
end if
if x3 >= 200 and x3 <= 300 and y3 >= 470 and y3 <= 500 then
if brickcolour2 = 1 then
drawfillbox (200, 470, 300, 500, 255)
brickcolour2 := 0
score := score + 15
elsif brickcolour2 = 2 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)
brickcolour2 := 1
score := score + 10
end if
yinc := -yinc
end if
if x3 >= 310 and x3 <= 410 and y3 >= 470 and y3 <= 500 then
if brickcolour3 = 1 then
drawfillbox (310, 470, 410, 500, 255)
brickcolour3 := 0
score := score + 15
elsif brickcolour3 = 2 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)
brickcolour3 := 1
score := score + 10
end if
yinc := -yinc
end if
if x3 >= 420 and x3 <= 520 and y3 >= 470 and y3 <= 500 then
if brickcolour4 = 1 then
drawfillbox (420, 470, 520, 500, 255)
brickcolour4 := 0
score := score + 15
elsif brickcolour4 = 2 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)
brickcolour4 := 1
score := score + 10
end if
yinc := -yinc
end if
if x3 >= 530 and x3 <= 630 and y3 >= 470 and y3 <= 500 then
if brickcolour5 = 1 then
drawfillbox (530, 470, 630, 500, 255)
brickcolour5 := 0
score := score + 15
elsif brickcolour5 = 2 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)
brickcolour5 := 1
score := score + 10
end if
yinc := -yinc
end if
if x3 >= 640 and x3 <= 740 and y3 >= 470 and y3 <= 500 then
if brickcolour6 = 1 then
drawfillbox (640, 470, 740, 500, 255)
brickcolour6 := 0
score := score + 15
elsif brickcolour6 = 2 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)
brickcolour6 := 1
score := score + 10
end if
yinc := -yinc
end if
if x3 >= 750 and x3 <= 850 and y3 >= 470 and y3 <= 500 then
if brickcolour7 = 1 then
drawfillbox (750, 470, 850, 500, 255)
brickcolour7 := 0
score := score + 15
elsif brickcolour7 = 2 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)
brickcolour7 := 1
score := score + 10
end if
yinc := -yinc
end if
if x3 >= 90 and x3 <= 190 and y3 >= 570 and y3 <= 600 then
if brickcolour8 = 1 then
drawfillbox (90, 570, 190, 600, 255)
brickcolour8 := 0
score := score + 15
elsif brickcolour8 = 2 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)
brickcolour8 := 1
score := score + 10
end if
yinc := -yinc
end if
if x3 >= 200 and x3 <= 300 and y3 >= 570 and y3 <= 600 then
if brickcolour9 = 1 then
drawfillbox (200, 570, 300, 600, 255)
brickcolour9 := 0
score := score + 15
elsif brickcolour9 = 2 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)
brickcolour9 := 1
score := score + 10
end if
yinc := -yinc
end if
if x3 >= 310 and x3 <= 410 and y3 >= 570 and y3 <= 600 then
if brickcolour10 = 1 then
drawfillbox (310, 570, 410, 600, 255)
brickcolour10 := 0
score := score + 15
elsif brickcolour10 = 2 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)
brickcolour10 := 1
score := score + 10
end if
yinc := -yinc
end if
if x3 >= 420 and x3 <= 520 and y3 >= 570 and y3 <= 600 then
if brickcolour11 = 1 then
drawfillbox (420, 570, 520, 600, 255)
brickcolour11 := 0
score := score + 15
elsif brickcolour11 = 2 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)
brickcolour11 := 1
score := score + 10
end if
yinc := -yinc
end if
if x3 >= 530 and x3 <= 630 and y3 >= 570 and y3 <= 600 then
if brickcolour12 = 1 then
drawfillbox (530, 570, 630, 600, 255)
brickcolour12 := 0
score := score + 15
elsif brickcolour12 = 2 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)
brickcolour12 := 1
score := score + 10
end if
yinc := -yinc
end if
if x3 >= 640 and x3 <= 740 and y3 >= 570 and y3 <= 600 then
if brickcolour13 = 1 then
drawfillbox (640, 570, 740, 600, 255)
brickcolour13 := 0
score := score + 15
elsif brickcolour13 = 2 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)
brickcolour13 := 1
score := score + 10
end if
yinc := -yinc
end if
if x3 >= 750 and x3 <= 850 and y3 >= 570 and y3 <= 600 then
if brickcolour14 = 1 then
drawfillbox (750, 570, 850, 600, 255)
brickcolour14 := 0
score := score + 15
elsif brickcolour14 = 2 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)
brickcolour14 := 1
score := score + 10
end if
yinc := -yinc
end if
end if
if brickcolour1 = 0 and brickcolour2 = 0 and brickcolour3 = 0 and brickcolour4 = 0 and brickcolour5 = 0
and brickcolour6 = 0 and brickcolour7 = 0 and brickcolour8 = 0 and brickcolour9 = 0 and brickcolour10 = 0
and brickcolour11 = 0 and brickcolour12 = 0 and brickcolour13 = 0 and brickcolour14 = 0 then
level := level + 1
playagain := "Y"
if speed not= 3 then
speed := speed - 1
end if
end if
Font.Draw ("Slow Motion/Bullet time", 100, maxy - 15, font2, 12)
if slowmotion not= 0 then
drawfillbox (300, maxy - 15, 310, maxy, 255)
Font.Draw (intstr (slowmotion - 1), 300, maxy - 15, font2, 12)
end if
drawfillbox (450, maxy - 15, 460, maxy, 255)
Font.Draw ("Ball Warp", 350, maxy - 15, font2, 12)
Font.Draw (intstr (ballwarp ), 450, maxy - 15, font2, 12)
drawfillbox (550, maxy - 15, 560, maxy, 255)
Font.Draw ("Lives", 500, maxy - 15, font2, 12)
Font.Draw (intstr (lives ), 550, maxy - 15, font2, 12)
drawfillbox (650, maxy - 15, 700, maxy, 255)
Font.Draw ("Score", 600, maxy - 15, font2, 12)
Font.Draw (intstr (score ), 650, maxy - 15, font2, 12)
drawfillbox (780, maxy - 15, 850, maxy, 255)
Font.Draw ("Level", 700, maxy - 15, font2, 12)
Font.Draw (intstr (level ), 750, maxy - 15, font2, 12)
exit when brickcolour1 = 0 and brickcolour2 = 0 and brickcolour3 = 0 and brickcolour4 = 0 and brickcolour5 = 0
and brickcolour6 = 0 and brickcolour7 = 0 and brickcolour8 = 0 and brickcolour9 = 0 and brickcolour10 = 0
and brickcolour11 = 0 and brickcolour12 = 0 and brickcolour13 = 0 and brickcolour14 = 0
end loop
if lives = 0 then
Font.Draw ("GAME OVER", midx - 100, midy + 5, font1, 12)
Font.Draw ("You reached level ", midx - 400, midy - 30, font1, 12)
Font.Draw (intstr (level ), midx - 80, midy - 30, font1, 12)
Font.Draw ("Your score was ", midx, midy - 30, font1, 12)
Font.Draw (intstr (score ), midx + 280, midy - 30, font1, 12)
level := 1
end if
exit when lives = 0 or (brickcolour1 = 0 and brickcolour2 = 0 and brickcolour3 = 0 and brickcolour4 = 0 and brickcolour5 = 0
and brickcolour6 = 0 and brickcolour7 = 0 and brickcolour8 = 0 and brickcolour9 = 0 and brickcolour10 = 0
and brickcolour11 = 0 and brickcolour12 = 0 and brickcolour13 = 0 and brickcolour14 = 0)
end loop
if lives <= 0 then
Font.Draw ("Do you want to play again?", midx - 200, midy - 70, font1, 12)
drawfillbox (midx - 200, midy - 133, midx - 100, midy - 100, 0)
Font.Draw ("YES", midx - 190, midy - 130, font1, 255)
drawfillbox (midx + 100, midy - 133, midx + 200, midy - 100, 255)
Font.Draw ("NO", midx + 110, midy - 130, font1, 0)
loop
Mouse.Where (x, y, button )
if x >= midx - 200 and x <= midx - 100 and y >= midy - 133 and y <= midy - 100 then
drawfillbox (midx - 200, midy - 133, midx - 100, midy - 100, 0)
Font.Draw ("YES", midx - 190, midy - 130, font1, 255)
drawfillbox (midx + 100, midy - 133, midx + 200, midy - 100, 255)
Font.Draw ("NO", midx + 110, midy - 130, font1, 0)
playagain := "Y"
end if
Mouse.Where (x, y, button )
if x >= midx + 100 and x <= midx + 180 and y >= midy - 133 and y <= midy - 300 then
drawfillbox (midx - 200, midy - 133, midx - 100, midy - 100, 255)
Font.Draw ("YES", midx - 190, midy - 130, font1, 0)
drawfillbox (midx + 100, midy - 133, midx + 180, midy - 100, 0)
Font.Draw ("NO", midx + 110, midy - 130, font1, 255)
playagain := "N"
end if
lives := 5
exit when Mouse.ButtonMoved ("down")
end loop
end if
exit when playagain = "N"
end loop
end ballbouncing
process paddlemoving
y4 := 50
loop
Mouse.Where (x1, y1, btn1 )
if x1 >= 0 and x1 <= maxx then
drawfillbox (x1 - 35, y2 - 20, x1 + 35, y2, 9)
delay (10)
drawfillbox (x1 - 35, y2 - 20, x1 + 35, y2, 255)
end if
exit when playagain = "N"
end loop
end paddlemoving
Font.Draw ("Instructions", midx - 100, maxy - 30, font1, 255)
Font.Draw ("PADDLE:", 20, 600, font2, 12)
Font.Draw ("To move the paddle, you just have to move the mouse. The Paddle moves left and right, not up and down.", 20, 570, font2, 255)
Font.Draw ("DESTROYING BRICKS:", 20, 510, font2, 12)
Font.Draw ("To destroy a brick, the ball has to hit the coloured center of the brick.", 20, 480, font2, 255)
drawfillbox (650, 484, 680, 486, 255)
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)
drawfillbox (540, 484, 680, 486, 255)
Font.Draw ("A red brick takes one hit to get destroyed, A green brick becomes red after one hit, and then gets destroyed after the next hit.", 20, 450, font2, 255)
Font.Draw ("SCORE:", 20, 390, font2, 12)
Font.Draw ("When a red brick is hit and destroyed. you get 15 points. When is a green brick is hit and turns red, you get 10 points.", 20, 360, font2, 255)
Font.Draw ("SPECIAL POWERS:", 20, 300, font2, 12)
Font.Draw ("You have 2 special powers or abilities. One of them is that you can slow down the ball for a certain amount of time. This can ", 20, 270, font2, 255)
Font.Draw ("be done 4 times a game. The other power is that you can warp the ball back to its starting location. This can be done 3 times a game.", 20, 240, font2, 255)
Font.Draw ("The left button of the mouse activiates the slow motion/bullet time. The right and middle buttons both activate the ball warp power.", 20, 210, font2, 255)
Font.Draw ("Every game the ball starts at a pretty slow speed. The ball gets faster as the level goes on. The higher the level", 20, 150, font2, 255)
Font.Draw ("the faster the ball goes during the level. You have 5 lives to get as far as you can. Good Luck! Click anywhere to start the game.", 20, 120, font2, 255)
Mouse.ButtonWait ("down", x1, y1, btn1, btn2 )
delay (500)
lives := 5
x1 := 10
y1 := 10
x2 := 70
y2 := 20
y4 := 50
x3 := 50
y3 := 50
r1 := 10
xinc := 4
yinc := 4
fork paddlemoving
fork ballbouncing
fork powers
%%%%%%%%%%%%%%%%%%%%% PAINT :
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, speed, level, score, ballwarp : int
loop
View.Set ("offscreenonly")
crsize := r1
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)
Font.Draw ("1", maxx - 80, 12, font3, 255)
Font.Draw ("2", maxx - 72, 12, font3, 9)
Font.Draw ("3", maxx - 64, 12, font3, 47)
Font.Draw ("4", maxx - 56, 12, font3, 14)
Font.Draw ("5", maxx - 48, 12, font3, 12)
Font.Draw ("6", maxx - 40, 12, font3, 114)
Font.Draw ("7", maxx - 32, 12, font3, 15)
Font.Draw ("8", maxx - 24, 12, font3, 42)
Font.Draw ("9", maxx - 16, 12, font3, 13)
Font.Draw ("0", maxx - 8, 12, font3, 0)
View.Update
View.Set ("offscreenonly")
Input.KeyDown (controls )
if sqcir = "circle" then
drawfilloval (x1, y1, r1, r1, colours )
if controls (KEY_UP_ARROW) and y1 + r1 <= maxy then
y1 := y1 + xinc
drawfilloval (x1, y1, r1, r1, colours )
end if
delay (10)
if controls (KEY_DOWN_ARROW) and y1 - r1 >= 0 then
y1 := y1 - xinc
drawfilloval (x1, y1, r1, r1, colours )
end if
if controls (KEY_RIGHT_ARROW) and x1 + r1 <= maxx then
x1 := x1 + xinc
drawfilloval (x1, y1, r1, r1, colours )
end if
if controls (KEY_LEFT_ARROW) and x1 - r1 >= 0 then
x1 := x1 - xinc
drawfilloval (x1, y1, r1, r1, colours )
end if
if controls ('+') then
r1 := r1 + 1
delay (50)
drawfilloval (x1, y1, r1, r1, colours )
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
if controls ('-') then
if r1 > 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 <= maxy then
y1 := y1 + xinc
y2 := y2 + xinc
drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours )
end if
delay (10)
if controls (KEY_DOWN_ARROW) and y1 >= 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 <= maxx then
x1 := x1 + xinc
x2 := x2 + xinc
drawfillbox (x1, y1, x1 + yinc, y1 + yinc, colours )
end if
if controls (KEY_LEFT_ARROW) and x1 >= 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
|
|