adzikowo
Nowy
Dołączył: 06 Kwi 2012
Posty: 1
Przeczytał: 0 tematów
Ostrzeżeń: 0/5 Skąd: leszno
|
Wysłany: Pią 18:00, 06 Kwi 2012 Temat postu: pilnie potrzebuję pomocy |
|
|
muszę do 19 kwietnia napisac prostą grę snake. w trybie graficznym. bez rekodów. prostu program na poziomie osoby kótra zna tylko podstawy turbopascala.
narazie mam tylko ruch kwadracika. proszę o pomoc. z góry dziękuję. to jest mój obecny kod.
uses graph,crt;
var
a,b,c,s,t,x1,x2,y1,y2,a1,b1,a2,b2,z:integer;
klawisz:char;
procedure gora;
begin
y1:=y1-10;
y2:=y2-10;
b:=20;
a:=0;
end;
procedure dol;
begin
y2:=y2+10;
y1:=y1+10;
a:=0;
b:=-20;
end;
procedure prawo;
begin
x2:=x2+10;
x1:=x1+10;
a:=-20;
b:=0;
end;
procedure lewo;
begin
x1:=x1-10;
x2:=x2-10;
a:=20;
b:=0;
end;
procedure plansza;
begin
setBkColor(5);
setfillstyle (solidfill,green);
bar (10,60,500,440);
setfillstyle (solidfill,blue);
bar (10,10,120,40);
bar (140,10,250,40);
bar (270,10,380,40);
bar (510,30,630,100);
bar (510,120,630,160);
bar (510,180,630,220);
bar (510,240,630,370);
bar (520,380,620,420);
bar (520,430,620,470);
outtextxy (20,20, 'kwadraciki');
outtextxy (150,20, 'koleczka');
outtextxy (280,20, 'trujkonty');
outtextxy (520,35,'nazwa gry');
outtextxy (520,125,'lvl');
outtextxy (520,190,'punkt');
outtextxy (520,240,' licznik');
outtextxy (530,384,'reset gry');
outtextxy (530,434,'wyjdz z gry');
readln;
end;
procedure glowa(x1,y1,x2,y2:integer);
begin
cleardevice;
delay(10);
setfillstyle (solidfill,blue);
x1:=80+x1;
y1:=50+y1;
x2:=90+x2;
y2:=60+y2;
bar (x1,y1,x2,y2);
end;
procedure cialo(x1,y1,x2,y2:integer);
begin
cleardevice;
delay(10);
setfillstyle (solidfill,red);
if c=1 then
begin
x1:=80+x1+a;
y1:=50+y1+b;
x2:=90+x2+a;
y2:=60+y2+b;
bar (x1,y1,x2,y2);
for c:=2 to z do
begin
x1:=x1+a;
y1:=y1+b;
x2:=x2+a;
y2:=y2+b;
bar (x1,y1,x2,y2);
end;
end;
end;
procedure losuj(a1,b1,a2,b2:integer);
begin
setfillstyle (solidfill,white);
a1:=200;
b1:=200;
a2:=210;
b2:=210;
bar (a1,b1,a2,b2);
end;
PROCEDURE Ruch;
BEGIN
repeat
klawisz := ReadKey;
{plansza;}
IF klawisz=#72 THEN gora;
IF klawisz=#80 THEN dol;
IF klawisz=#75 THEN lewo;
IF klawisz=#77 THEN prawo;
glowa(x1,y1,x2,y2);
losuj(a1,b1,a2,b2);
{jedzenie}
IF (x1=a1+120) and (y1=b1+150) then
begin
c:=1;
z:=3;
cialo(x1,y1,x2,y2);
end;
until klawisz=#27;
END;
begin
detectgraph(s,t);
initgraph (s,t,'C:\TP\BGI');
ruch;
end.
Post został pochwalony 0 razy
|
|