program MegaBALL; var waiting, x, y, xStep, yStep, down, up, len, speed, go, position: integer; fon, kur, pause, menu: image; procedure gameover(go: integer); begin drawImage(kur,0,150); setColor(0,0,0); drawText('Vu nabrali '+IntegerToString(go)+' ochkov',10,150); repaint; delay(9000); end; procedure pause; begin drawImage(pause,0,0); setColor(255,255,255); drawText('Press 5', 120-GetStringWidth('Press 5')/2,150); repaint; while (getKeyPressed<>KE_KEY5) do begin delay(100); end; end; procedure gamemenu; begin position := 80; waiting :=0; while(true) do begin drawImage(fon,0,0); drawImage(menu,0,60); drawImage(kur,0,position); setColor(0,0,0); drawText('Play',120-GetStringWidth('Play')/2,80); drawText('Records',120-GetStringWidth('Records')/2,110); drawText('Information',120-GetStringWidth('Information')/2,140); drawText('Exit',120-GetStringWidth('Exit')/2,170); setColor(255,255,0); drawText('MegaBALL',120-GetStringWidth('MegaBALL')/2,5); repaint; if (position=80)and(getKeyPressed=KE_KEY5) then break; if (position=170)and(getKeyPressed=KE_KEY5) then halt; if (getKeyPressed=KE_KEY8) then waiting := 1; if (getKeyPressed=KE_KEY2) then waiting := (-1); position := position + waiting; if (position<70) then begin position :=180; waiting :=(-1); end; if (position > 180) then begin position:=70; waiting:=1; end; if(position=80)or(position=110)or(position=140)or(position=170) then waiting := 0; end; end; begin waiting := 0; kur := loadImage('/kur.png'); fon := loadImage('/fon.jpg'); pause := loadImage('/pause.png'); menu := loadImage('/menu.png'); while (waiting < 200) do begin drawImage(fon, 0, 0); setColor(0, 0, 0); drawRect(17, 143, 205, 26); drawRect(18, 144, 203, 24); drawRect(19, 145, 201, 22); setColor(255, 255, 0); fillRect(20, 146, waiting, 21); drawText('MegaBALL', 120 - GetStringWidth('MegaBALL') / 2, 5); waiting := waiting + 1; setColor(100, 100, 100); drawText(' ' + waiting / 2 + '%', 107, 145); setColor(0, 0, 0); drawText('Naik Software', 120 - GetStringWidth('Naik Software') / 2, 280); repaint; end; x := 50 + random(150); y := 100 + random(100); xStep := 1; yStep := 1; down := 100; up := 100; len := 40; speed := 0; go := 0; gamemenu; while (true) do begin drawImage(fon, 0, 0); if (x > -1) and (x < 256) then setColor(255, x, 255 - x); drawText(' ' + go, 100, 150); if (y <= 10) and (x > up - 20) and (x < up + len) then begin go := go + 1; if (go > 10) and (go < 20) then speed := 1; if (go > 20) and (go < 30) then speed := 2; if (go > 30) and (go < 40) then speed := 3; if (go > 40) and (go < 50) then speed := 4; if (go > 50) then speed := 5; if (x < up - 10) then begin xStep := -(random(2)) - speed; if (xStep = 0) then xStep := -2; end; if (x > up + len -10) then begin xStep := random(2) + speed; if (xStep = 0) then xStep := 2; end; yStep := 1 + speed; if (y<5) then yStep := -1; end; if (y >= 290) and (x > down - 20) and (x < down + len) then begin go := go + 1; if (go > 10) and (go < 20) then speed := 1; if (go > 20) and (go < 30) then speed := 2; if (go > 30) and (go < 40) then speed := 3; if (go > 40) and (go < 50) then speed := 4; if (go > 50) then speed := 5; if (x < down - 10) then begin xStep := -(random(2)) - speed; if (xStep = 0) then xStep := -2; end; if (x > down + len - 10) then begin xStep := random(2) + speed; if (xStep = 0) then xStep := 2; end; yStep := -1 - speed; if (y>315) then yStep := 1; end; if (x <= 0) then xStep := 1 + speed; if (x >= 220) then xStep := -1 - speed; if (y <= -20) then gameover(go); if (y >= 320) then gameover(go); x := x + xStep; y := y + yStep; fillEllipse(x, y, 20, 20); setColor(0, 0, 255); if (getKeyPressed = KE_KEY7) then down := down - speed - 1; if (getKeyPressed = KE_KEY9) then down := down + speed + 1; if (down < 0) then down := 0; if (down > 240 - len) then down := 240 - len; if (getKeyPressed = KE_KEY1) then up := up - speed - 1; if (getKeyPressed = KE_KEY3) then up := up + speed + 1; if (up < 0) then up := 0; if (up > 240 - len) then up := 240 - len; fillRoundRect(down, 310, len, 10, 3, 3); fillRoundRect(up, 0, len, 10, 3, 3); if (isMidletPaused) or (getKeyPressed = KE_STAR) then pause; repaint; end; end.