Unit KeHre; (**) Interface (**) Uses Knihovna,Crt,B_P1,B_P2,B_P3,B_P5,Graph; Var Akt:byte; i:integer; Menu: array[0..4] of string; Jaka,Jaka2:integer; Lev:array[0..12] of Char; F:file of char; G:char; Procedure Uvod; Procedure Vitez; Procedure Utopil; Function DejMenu:integer; Procedure Polozka(X,Typ:byte); Procedure Smaz; Procedure NovaHra; Procedure Informace; Procedure Ovladani; Procedure Prvky; Procedure Ukonci; (**) Implementation (**) Procedure Prvky; Begin Jaka2:=-10; Smaz; Rectangle(240,120,630,404); B_P5.NapisText(270,130,'Podlaha',1); B_P5.NapisText(270,155,'Stena',1); B_P5.NapisText(270,180,'Bedna (lze posunout)',1); B_P5.NapisText(395,205,'Barevne zamky',1); B_P5.NapisText(395,230,'Barevne klice',1); B_P5.NapisText(270,255,'Cil',1); B_P5.NapisText(270,280,'Teleport',1); B_P5.NapisText(295,305,'Lavky (hnedou lze prejit)',1); B_P5.NapisText(295,330,'Prepinace lavek',1); B_P5.NapisText(270,355,'Voda (bez dreva se utopite)',1); B_P5.NapisText(270,380,'Drevo (zrusi vodu)',1); End; (**) Procedure Smaz; Var i:integer; a:byte; Begin SetFillStyle(1,0); Bar(240,120,640,480); for i:=1 to 45 do Begin a:=Random(4);If a=1 then a:=7; if a=2 then a:=8;if a=3 then a:=15; PutPixel(Random(400)+240,Random(360)+120,a); End; End; (**) Procedure NovaHra; Var i,o:byte; s:string; Label Prs; Begin If Jaka2=0 then Jaka2:=1; Smaz; Rectangle(240,120,630,384); repeat For i:=1 to 13 do Begin Str(i-1,s); if i=1 then s:='Tutorial' else S:='Level '+s; if i=Jaka2 then Begin B_P5.napisText(240,i*20+105,s,0); If Lev[i-1]='0' then B_P5.napistext(380,i*20+105,'nedokonceno',0) else B_P5.napistext(380,i*20+105,'dokonceno',0) End else Begin B_P5.napisText(240,i*20+105,s,1); If Lev[i-1]='0' then B_P5.napistext(380,i*20+105,'nedokonceno',1) else B_P5.napistext(380,i*20+105,'dokonceno',1) End; End; o:=ord(Readkey); case o of 072: Begin if Jaka2=1 then jaka2:=13 else jaka2:=jaka2-1; End; 080: Begin if Jaka2=13 then jaka2:=1 else jaka2:=jaka2+1; End; 13: Goto Prs; End; until o=27; Jaka2:=0; Smaz; Prs: End; (**) Procedure Informace; Begin Jaka2:=-1; Smaz; Rectangle(240,120,630,384); B_P5.NapisText(240,125,'Bludiste patri mezi hry logicke.',1); B_P5.NapisText(240,145,'Cilem hry je dostat do cile.',1); B_P5.NapisText(240,165,'Cestou vsak potkate ruzne ',1); B_P5.NapisText(240,185,'prekazky, ktere musite zdolat.',1); B_P5.NapisText(240,205,'Hra ma 12 urovni a uroven 0 -',1); B_P5.NapisText(240,225,'tutorial, ktery vam pomuze se',1); B_P5.NapisText(240,245,'ve hre lepe orientovat.',1); B_P5.NapisText(240,275,'Hodne stesti...',1); B_P5.NapisText(240,305,'(Hra vznikla jako seminarni',1); B_P5.NapisText(240,325,'prace na hodiny IVT.)',1); B_P5.NapisText(240,345,'Naprogramoval: Jan Dvorak',1); B_P5.NapisText(240,365,'E-mail: dvorkaman@centrum.cz',1); End; (**) Procedure Ovladani; Begin Jaka2:=-1; Smaz; Rectangle(240,120,630,275); B_P5.NapisText(240,125,'Pohyb hrace: Sipky',1); B_P5.NapisText(240,145,'Sebrat predmet: S',1); B_P5.NapisText(240,165,'Plozit predmet: F',1); B_P5.NapisText(240,185,'Navrat do menu: Escape',1); B_P5.NapisText(240,215,'Muzete drzet pouze 1 predmet.',1); B_P5.NapisText(240,235,'Predmet se pouzije automaticky',1); B_P5.NapisText(240,255,'v situaci k menu pridruzene.',1); End; (**) Procedure Polozka(X,Typ:byte); Var a,b:byte; Begin If Typ=0 then begin for i:=0 to 4 do Begin if i=X then b:=2 else b:=1; B_P2.NapisText(50,i*35+130,Menu[i],b); End; End; End; (**) Procedure Uvod; Var i,o,p:integer; Begin For i:=1 to 100 do Hvezda; B_P3.Napistext(203,120,'Jan Dvorak uvadi',0); B_P1.Napistext(137,200,'BLUDISTE',1); Delay(4000); for p:=1 to 150 do for i:=1 to 400 do Begin o:=random(15000); if o=0 then o:=15 else if o=1 then o:=7 else if o=2 then o:=8 else o:=0; PutPixel(i+136,p+120,o); for o:=1 to 1000 do o:=o; End; Delay(500); ClearDevice; For i:=1 to 100 do Hvezda; B_P2.NapisText(20,20,'Tato hra vznikla jako seminarni prace',1); B_P2.NapisText(20,50,'na hodinu IVT|',1); B_P2.NapisText(20,110,'Cilem hry je dostat se ze startu do',1); B_P2.NapisText(20,140,'cile| Hrace ovladate sipkami| ',1); B_P2.NapisText(20,170,'Predmet seberete klavesou S a zahodite',1); B_P2.NapisText(20,200,'klavesou F|',1); B_P2.NapisText(20,260,'Hodne stesti|||',1); B_P2.NapisText(20,410,'Naprogramoval Jan Dvorak',1); B_P2.NapisText(20,440,'dvorkaman@centrum|cz',1); Readkey; End; (**) Procedure Vitez; Var i:integer; Begin Delay(500); ClearDevice; For i:=1 to 100 do hvezda; B_P1.napistext(90,200,'VYHRAL JSI',1); Delay(4000); End; (**) Procedure Utopil; Var i:integer; Begin Delay(500); ClearDevice; For i:=1 to 100 do hvezda; B_P2.Napistext(175,180,'Prave ses utopil',1); B_P2.Napistext(191,260,'Zkus to znova',1); Delay(4000); End; Function DejMenu:integer; Var i,o:integer; Label Pres; Begin if Jaka2<>-10 then begin ClearDevice; For i:=1 to 100 do hvezda; setcolor(7); Rectangle(43,120,229,298); Line(60,0,60,120); Line(212,0,212,120); Rectangle(60,298,212,310); Assign(F,'Levely.dat'); Reset(F); For i:=0 to 12 do begin Read(f,g); Lev[i]:=g; End; Close(f); End; Repeat Polozka(Jaka,0); If Jaka2>0 then Begin NovaHra;if jaka2>0 then goto pres;End; i:=Ord(Readkey); Case i of 072: If Jaka2=0 then Begin If Jaka=0 then Jaka:=4 else Jaka:=Jaka-1; End; 080: if Jaka2=0 then Begin If Jaka=4 then Jaka:=0 else Jaka:=Jaka+1; End; 13: Begin If Jaka2=0 then Begin Case Jaka of 0:Begin NovaHra; If Jaka2>0 then Goto Pres; End; 1:Informace; 2:Ovladani; 3:Begin Prvky;Goto Pres;End; 4:Goto Pres; End; ENd; End; 27: If Jaka2=0 Then Goto Pres else Begin Jaka2:=0; Smaz;End; End; Until i<>i; Pres: If Jaka2=0 then DejMenu:=20 else if Jaka2=-10 then DejMenu:=-10 else DejMenu:=Jaka2-1; End; (**) Procedure Ukonci; Begin ClearDevice; For i:=1 to 100 do Hvezda; B_P1.Napistext(137,180,'BLUDISTE',1); B_P5.NapisText(155,280,'Probiha ukonceni aplikace...',1); Delay(4000); CloseGraph; Barva(7,0);ClrScr; Locate(1,5,DejNaStred('B L U D I S T E')); Locate(1,13,DejNaStred('Naprogramoval Jan Dvorak')); Locate(1,16,DejNaStred('E - mail: dvorkaman@centrum.cz')); Locate(1,23,DejNaStred('Porkacujte libovolnou klavesou...')); VytvorRam(1,1,80,24,2); VytvorVlastniOkraj('ÃÄ´defg'); VytvorRam(1,9,80,9,0); Readkey; End; (**) Begin Akt:=0;Jaka2:=0;Jaka:=0; Menu[0]:='Zacit hru'; Menu[1]:='Informace'; Menu[2]:='Ovladani'; Menu[3]:='Herni prvky'; Menu[4]:='Ukoncit'; End.