View.Set ("graphics:max,max") var size : int := 50 var mx, my, mb : int var collidex, collidey : int := 0 var ballx, bally : int := 200 var dirx, diry : int := 0 var ballSpeed : int := 1 var hit : string := "no" var point : int :=0 var life : int:=0 % What box did we hit????? % Ball direction after it hits paddle % Change ball Speed % Levels ?? % balls left % Paddle size % Obsticles (Difficult) dirx := ballSpeed diry := ballSpeed for x : 100 .. 800 by 100 for y : 300 .. 600 by 100 drawfillbox (x, y, x + 50, y + 30, red) end for end for loop delay (7) mousewhere (mx, my, mb) drawfillbox (mx - size, 0, mx + size, 50, black) drawfillbox (mx - size - 1, 0, 0, 50, white) drawfillbox (maxx, 0, mx + size + 1, 50, white) drawfilloval (ballx, bally, 15, 15, white) ballx += dirx bally += diry drawfilloval (ballx, bally, 15, 15, Rand.Int (0,maxcolor)) if ballx >= maxx then % right wall dirx := - (dirx) elsif bally >= maxy then % top wall diry := - (diry) elsif ballx <= 0 then % bottom dirx := - (dirx) elsif bally <= 0 then % left wall diry := - (diry) locate (1, 1) put "lost ball" life+=1 put point ballx := 200 bally := 200 loop mousewhere (mx, my, mb) exit when mb = 1 end loop end if %paddle collision if ballx > mx - size and ballx < mx + size and bally <= 66 then diry := - (diry) end if for i : 10 .. 20 % top of ball if whatdotcolour (ballx - 15 + i, bally + 16) = red then diry := - (diry+1) %top collidex := ballx div 100 collidey := (bally + 16) div 100 collidex := collidex * 100 collidey := collidey * 100 drawfillbox (collidex, collidey, collidex + 50, collidey + 30, blue) point+=1 exit end if if whatdotcolour (ballx - 15 + i, bally - 16) = red then diry := - (diry) % bottom collidex := ballx div 100 collidey := (bally - 16) div 100 collidex := collidex * 100 collidey := collidey * 100 drawfillbox (collidex, collidey, collidex + 50, collidey + 30, blue) point+=1 exit end if if whatdotcolour (ballx + 16, bally - 15 + i) = red then dirx := - (dirx) collidex := (ballx + 16) div 100 collidey := bally div 100 collidex := collidex * 100 collidey := collidey * 100 drawfillbox (collidex, collidey, collidex + 50, collidey + 30, blue) point+=1 exit end if if whatdotcolour (ballx - 16, bally - 15 + i) = red then dirx := - (dirx) % left collidex := (ballx - 16) div 100 collidey := bally div 100 collidex := collidex * 100 collidey := collidey * 100 drawfillbox (collidex, collidey, collidex + 50, collidey + 30, blue) point+=1 %2 diry := - (diry+1) %top collidex := ballx div 100 collidey := (bally + 16) div 100 collidex := collidex * 100 collidey := collidey * 100 drawfillbox (collidex, collidey, collidex + 50, collidey + 30, white) point+=1 exit end if if whatdotcolour (ballx - 15 + i, bally - 16) = blue then diry := - (diry) % bottom collidex := ballx div 100 collidey := (bally - 16) div 100 collidex := collidex * 100 collidey := collidey * 100 drawfillbox (collidex, collidey, collidex + 50, collidey + 30, white) point+=1 exit end if if whatdotcolour (ballx + 16, bally - 15 + i) = blue then dirx := - (dirx) collidex := (ballx + 16) div 100 collidey := bally div 100 collidex := collidex * 100 collidey := collidey * 100 drawfillbox (collidex, collidey, collidex + 50, collidey + 30, white) point+=1 exit end if if whatdotcolour (ballx - 16, bally - 15 + i) = blue then dirx := - (dirx) % left collidex := (ballx - 16) div 100 collidey := bally div 100 collidex := collidex * 100 collidey := collidey * 100 drawfillbox (collidex, collidey, collidex + 50, collidey + 30, white) point+=1 exit end if end for exit when life = 3 end loop put "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!GAME OVER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"