NickITOS | Дата: Пятница, 23.12.2011, 16:24 | Сообщение # 1 |
Группа: Удаленные
| Привет всем! Недавно я скачал с этого сайта исходный код игры "Волк-яйцелов" и решил "подогнать" сие чудо под свой Nokia 3100. Столкнулся с проблемой - волк "тупит". Вот код:Code program NuPogodi; var von1,von2,volk3,volk9,volk7,volk1,no_fon,img:image; volk_i:integer; iaiza: array[1..4]of image; iaiza_i:array[1..4]of integer; iaiza_2:array[1..4]of integer; iaiza_3:array[1..4]of integer; iaiza_4:array[1..4]of integer; i,p,povorot,no:integer; igra,exit_1:integer; show,pusk,exit_2,exit_3,pausa,norm:command;
procedure volc_povorot(a:integer); begin if a=3 then begin drawimage(volk3,46,50); end; if a=9 then begin drawimage(volk9,46,50); end; if a=1 then begin drawimage(volk1,46,50); end; if a=7 then begin drawimage(volk7,46,50); end; repaint; delay(10); end;
procedure tur; begin iaiza_i[1]:=0; iaiza_i[2]:=0; iaiza_i[3]:=0; iaiza_i[4]:=0; iaiza_2[1]:=0; iaiza_2[2]:=0; iaiza_2[3]:=0; iaiza_2[4]:=0; iaiza_3[1]:=0; iaiza_3[2]:=0; iaiza_3[3]:=0; iaiza_3[4]:=0; iaiza_4[1]:=0; iaiza_4[2]:=0; iaiza_4[3]:=0; iaiza_4[4]:=0; drawimage(iaiza[4],119,40);drawimage(iaiza[4],119,63); drawimage(iaiza[4],108,42); drawimage(iaiza[4],108,66); drawimage(iaiza[4],97,47);drawimage(iaiza[4],97,72); drawimage(iaiza[4],86,56);drawimage(iaiza[4],86,81); drawimage(iaiza[4],2,40);drawimage(iaiza[4],2,63); drawimage(iaiza[4],13,42); drawimage(iaiza[4],13,67); drawimage(iaiza[4],24,48); drawimage(iaiza[4],24,73); drawimage(iaiza[4],35,56);drawimage(iaiza[4],35,81); end;
procedure no_iaiz(i:integer); begin iaiza_i[1]:=0; iaiza_i[2]:=0; iaiza_i[3]:=0; iaiza_i[4]:=0; iaiza_2[1]:=0; iaiza_2[2]:=0; iaiza_2[3]:=0; iaiza_2[4]:=0; iaiza_3[1]:=0; iaiza_3[2]:=0; iaiza_3[3]:=0; iaiza_3[4]:=0; iaiza_4[1]:=0; iaiza_4[2]:=0; iaiza_4[3]:=0; iaiza_4[4]:=0; drawimage(iaiza[4],119,40);drawimage(iaiza[4],119,63); drawimage(iaiza[4],108,42); drawimage(iaiza[4],108,66); drawimage(iaiza[4],97,47);drawimage(iaiza[4],97,72); drawimage(iaiza[4],86,56);drawimage(iaiza[4],86,81); drawimage(iaiza[4],2,40);drawimage(iaiza[4],2,63); drawimage(iaiza[4],13,42); drawimage(iaiza[4],13,67); drawimage(iaiza[4],24,48); drawimage(iaiza[4],24,73); drawimage(iaiza[4],35,56);drawimage(iaiza[4],35,81); drawimage(no_fon,112-(no*15),22);repaint; end;
procedure key; begin if getKeyPressed=ke_key3 then begin volk_i:=3; volc_povorot(3);povorot:=3;end; if getKeyPressed=ke_key9 then begin volk_i:=9; volc_povorot(9);povorot:=9;end; if getKeyPressed=ke_key1 then begin volk_i:=1; volc_povorot(1);povorot:=1;end; if getKeyPressed=ke_key7 then begin volk_i:=7; volc_povorot(7);povorot:=7;end; end;
procedure pos_iaiza(pos:integer); begin if iaiza_4[4]=1 then begin iaiza_4[4]:=0;drawimage(iaiza[4],35,81); volc_povorot(povorot); no:=no+1; no_iaiz(1); end; if iaiza_4[3]=1 then begin if volk_i=7 then begin iaiza_4[4]:=0; iaiza_4[3]:=0; drawimage(iaiza[4],24,73); p:=p+1; volc_povorot(povorot); end;end; if iaiza_4[3]=1 then begin iaiza_4[3]:=0;iaiza_4[4]:=1; drawimage(iaiza[1],35,81); drawimage(iaiza[4],24,73); end; if iaiza_4[2]=1 then begin iaiza_4[2]:=0;iaiza_4[3]:=1; drawimage(iaiza[3],24,73); drawimage(iaiza[4],13,67); end; if iaiza_4[1]=1 then begin iaiza_4[1]:=0;iaiza_4[2]:=1; drawimage(iaiza[2],13,67); drawimage(iaiza[4],2,63); end; if pos=4 then begin if iaiza_4[1]=0 then begin iaiza_4[1]:=1; drawimage(iaiza[1],2,63); end;end; if iaiza_3[4]=1 then begin iaiza_3[4]:=0;drawimage(iaiza[4],35,56); volc_povorot(povorot); no:=no+1; no_iaiz(1); end; if iaiza_3[3]=1 then begin if volk_i=1 then begin iaiza_3[4]:=0; iaiza_3[3]:=0; drawimage(iaiza[4],24,48); p:=p+1; volc_povorot(povorot); end;end; if iaiza_3[3]=1 then begin iaiza_3[3]:=0;iaiza_3[4]:=1; drawimage(iaiza[1],35,56); drawimage(iaiza[4],24,48); end; if iaiza_3[2]=1 then begin iaiza_3[2]:=0;iaiza_3[3]:=1; drawimage(iaiza[3],24,48); drawimage(iaiza[4],13,42); end; if iaiza_3[1]=1 then begin iaiza_3[1]:=0;iaiza_3[2]:=1; drawimage(iaiza[2],13,42); drawimage(iaiza[4],2,40); end; if pos=3 then begin if iaiza_3[1]=0 then begin iaiza_3[1]:=1; drawimage(iaiza[1],2,40); end;end; if iaiza_2[4]=1 then begin iaiza_2[4]:=0;drawimage(iaiza[4],86,81); volc_povorot(povorot); no:=no+1; no_iaiz(2); end; if (iaiza_2[3]=1)and(volk_i=9) then begin iaiza_2[4]:=0; iaiza_2[3]:=0; drawimage(iaiza[4],97,72); p:=p+1; volc_povorot(povorot); end; if iaiza_2[3]=1 then begin iaiza_2[3]:=0;iaiza_2[4]:=1; drawimage(iaiza[1],86,81); drawimage(iaiza[4],97,72); end; if iaiza_2[2]=1 then begin iaiza_2[2]:=0;iaiza_2[3]:=1; drawimage(iaiza[3],97,72); drawimage(iaiza[4],108,66); end; if iaiza_2[1]=1 then begin iaiza_2[1]:=0;iaiza_2[2]:=1; drawimage(iaiza[2],108,66); drawimage(iaiza[4],119,63); end; if pos=2 then begin if iaiza_2[1]=0 then begin iaiza_2[1]:=1; drawimage(iaiza[1],119,63); end;end; if iaiza_i[4]=1 then begin iaiza_i[4]:=0;drawimage(iaiza[4],86,56); volc_povorot(povorot); no:=no+1; no_iaiz(2); end; if iaiza_i[3]=1 then begin if volk_i=3 then begin iaiza_i[4]:=0; iaiza_i[3]:=0; drawimage(iaiza[4],97,47); p:=p+1; volc_povorot(povorot); end;end; if iaiza_i[3]=1 then begin iaiza_i[3]:=0;iaiza_i[4]:=1; drawimage(iaiza[1],86,56); drawimage(iaiza[4],97,47); end; if iaiza_i[2]=1 then begin iaiza_i[2]:=0;iaiza_i[3]:=1; drawimage(iaiza[3],97,47); drawimage(iaiza[4],108,42); end; if iaiza_i[1]=1 then begin iaiza_i[1]:=0;iaiza_i[2]:=1; drawimage(iaiza[2],108,42); drawimage(iaiza[4],119,40); end; if pos=1 then begin if iaiza_i[1]=0 then begin iaiza_i[1]:=1; drawimage(iaiza[1],119,40); end;end; repaint; end;
procedure games; begin ShowCanvas; drawimage(img,0,0); drawimage(von1,0,50); drawimage(von2,97,50); drawimage(volk3,46,50); volk_i:=3; iaiza_i[1]:=0; iaiza_i[2]:=0; iaiza_i[3]:=0; iaiza_i[4]:=0; iaiza_2[1]:=0; iaiza_2[2]:=0; iaiza_2[3]:=0; iaiza_2[4]:=0; iaiza_3[1]:=0; iaiza_3[2]:=0; iaiza_3[3]:=0; iaiza_3[4]:=0; iaiza_4[1]:=0; iaiza_4[2]:=0; iaiza_4[3]:=0; iaiza_4[4]:=0; repaint; i:=0; p:=0; no:=0; begin exit_3:=createcommand('Выход',cm_exit,1); addcommand(exit_3); pausa:=createcommand('Пауза',cm_ok,2); addcommand(pausa); repeat randomize; i := 1 + Random(4); pos_iaiza(i); delay(1000); key; norm:=getclickedcommand; if norm=pausa then begin repeat delay(100); until getclickedcommand=pausa; end; until (norm=exit_3)or(no=5); drawText('КОНЕЦ ИГРЫ', 39, 35); repaint; delay(300); end; removeCommand(exit_3); removeCommand(pausa); end;
procedure menu; begin showmenu('Меню',ch_implicit); pusk:=createcommand('Выбрать',cm_screen,1); addcommand(pusk); igra:=menuappendstring('Игра'); exit_1:=menuappendstring('Выход'); repeat delay(100); show:=getclickedcommand; until show=pusk; removeCommand(pusk); if menugetselectedindex=igra then games; if menugetselectedindex=exit_1 then halt; end;
begin img:=loadimage('/NewImage.png'); von1:=loadimage('/von_l_3.png'); von2:=loadimage('/von_p_2.png'); volk3:=loadimage('/volk_p_v.png'); volk9:=loadimage('/volk_p_n.png'); volk1:=loadimage('/volk_l_v.png'); volk7:=loadimage('/volk_l_n.png'); iaiza[1]:=loadimage('/iaizo_1.png'); iaiza[2]:=loadimage('/iaizo_2.png'); iaiza[3]:=loadimage('/iaizo_3.png'); iaiza[4]:=loadimage('/iaizo_0.png'); no_fon:=loadimage('/no.png'); while true do Menu; end.
Сообщение отредактировал NickITOS - Пятница, 23.12.2011, 16:27 |
|
| |