פייסבוק
Facebook Pagelike Widget
פרסומת

פרוייקט בפסקל – משחק מגניב מאוד!


uses crt;
const
n=40;

type
location=record
x:integer;
y:integer;
w:char;
end;
pos=^link;
link=record
info:location;
next:pos;
end;
list=record
anchor:pos;
end;


var
tank, target:location;
d:char;
l_bulet:list;
q:pos;
i, speed, stage, c_shoot, c_hit:integer;
level:char;

procedure list_init(var l:list);

begin
new(l.anchor);
l.anchor^.next:=nil;
end;

function list_prev(l:list;p:pos):pos;
var
q:pos;
begin
q:=l.anchor;
while q^.next p do
q:=q^.next;
list_prev:=q;
end;
procedure add_unit (var l:list);
var
q,p:pos;
begin
new(q);
q^.next:=nil;
p:=list_prev(l, q^.next);
p^.next:=q;
end;
procedure delete(var p:pos; var l:list);
var
q:pos;
begin
q:=list_prev(l,p);
q^.next:=p^.next;
dispose(p);
p:=q^.next;
end;
function last_unit (l:list):pos;
begin
last_unit:=list_prev(l, nil);
end;
function list_empty (l:list):boolean;
begin
if l.anchor^.next=nil then
list_empty:=true
else
list_empty:=false;
end;

procedure m_tank (d:char; var tank:location);
begin
gotoxy(tank.x-2, tank.y);
write(‘ ‘);
gotoxy(tank.x-2, tank.y+1);
write(‘ ‘);
if (tank.x=77) and (d=’6′) then
tank.x:=3
else if (tank.x=3) and (d=’4′) then
tank.x:=77
else if d=’4′ then
tank.x:=tank.x-1
else if d=’6′ then
tank.x:=tank.x+1;
gotoxy(tank.x-2,tank.y);
write (‘ֹֽ׀ֽ»’);
gotoxy(tank.x-2, tank.y+1);
write (‘*****’);
{readkey;}
end;
procedure print_shoot (l_bulet:list);
var
p:pos;
begin
p:=l_bulet.anchor^.next;
while pnil do
begin
gotoxy(p^.info.x, p^.info.y);
write (‘^’);
if p^.info.w=’7′ then
begin
gotoxy(p^.info.x+1, p^.info.y+1);
end
else if p^.info.w=’8′ then
gotoxy(p^.info.x, p^.info.y+1)
else if p^.info.w=’9′ then
begin
gotoxy(p^.info.x-1,p^.info.y+1);
end;
write (‘ ‘);
p:=p^.next;
end;
end;
procedure m_shoot (var l_bulet:list);
var
p:pos;
bu:boolean;
begin
p:=l_bulet.anchor^.next;
while pnil do
begin
bu:=false;
if p^.info.w=’7′ then
begin
p^.info.x:=p^.info.x-1;
p^.info.y:=p^.info.y-1;
end
else if p^.info.w=’8′ then
p^.info.y:=p^.info.y-1
else if p^.info.w=’9′ then
begin
p^.info.x:=p^.info.x+1;
p^.info.y:=p^.info.y-1;
end;
if (p^.info.x=0) or (p^.info.y=0) or (p^.info.x>80) then
begin
if p^.info.w=’7′ then
begin
gotoxy(p^.info.x+1, p^.info.y+1);
end
else if p^.info.w=’8′ then
gotoxy(p^.info.x, p^.info.y+1)
else if p^.info.w=’9′ then
begin
gotoxy(p^.info.x-1,p^.info.y+1);
end;
write(‘ ‘);
delete (p, l_bulet);
bu:=true;
end;
if not bu then
p:=p^.next;
end;
print_shoot (l_bulet);
end;
procedure m_target (var target:location);
begin
gotoxy(target.x+1, target.y-1);
write(‘ ‘);
gotoxy(target.x, target.y);
write(‘ ‘);
gotoxy(target.x+1, target.y+1);
write(‘ ‘);
dec(target.x);
gotoxy(target.x+1, target.y-1);
write (‘ײִ’);
gotoxy(target.x, target.y);
write (‘ֽ־ֽֽ־’);
gotoxy(target.x+1, target.y+1);
write(‘׃ִ’);
end;
function check_hit (var target:location; var l_bulet:list):boolean;
var
p:pos;
bu:boolean;
i,j:integer;
v,a:integer;
begin
i:=target.x;
j:=target.y;
p:=l_bulet.anchor^.next;
a:=p^.info.x;
v:=p^.info.y;
while ((ai) and (ai+1) and (ai+2) and (ai+3) and (ai+4) and (pnil)) or ((vj) and (vj+1) and (pnil)) do
begin
p:=p^.next;
a:=p^.info.x;
v:=p^.info.y;
end;
if pnil then
begin
gotoxy(p^.info.x,p^.info.y);
write(‘ ‘);
delete(p, l_bulet);
check_hit:=true;
end
else
check_hit:=false;
end;
procedure boom (var target:location; stage:integer; var c_hit:integer);
begin
if stage=1 then
begin
gotoxy(target.x+1, target.y-1);
write(‘ ‘);
gotoxy(target.x, target.y);
write(‘ ‘);
gotoxy(target.x+1, target.y+1);
write(‘ ‘);
textbackground(red);
gotoxy(target.x+5,target.y-1);
write(‘½’);
gotoxy(target.x+5,target.y+1);
write(‘·’);
gotoxy(target.x+4,target.y);
write(‘ֽ’);
gotoxy(target.x+2,target.y);
write(‘ֽ’);
gotoxy(target.x+2,target.y+3);
write(‘ִ’);
gotoxy(target.x+2,target.y-3);
write(‘ִ’);
gotoxy(target.x+1,target.y-3);
write(‘ײ’);
gotoxy(target.x+1,target.y+3);
write(‘׃’);
gotoxy(target.x+1,target.y+1);
write(‘ײ’);
gotoxy(target.x+1,target.y-1);
write(‘׃’);
gotoxy(target.x,target.y);
write(‘ֽ’);
textbackground(black);
end;
if stage=2 then
begin
gotoxy(target.x+5,target.y-1);
write(‘ ‘);
gotoxy(target.x+5,target.y+1);
write(‘ ‘);
gotoxy(target.x+4,target.y);
write(‘ ‘);
gotoxy(target.x+3,target.y);
write(‘ ‘);
gotoxy(target.x+2,target.y);
write(‘ ‘);
gotoxy(target.x+2,target.y+3);
write(‘ ‘);
gotoxy(target.x+2,target.y-3);
write(‘ ‘);
gotoxy(target.x+1,target.y-3);
write(‘ ‘);
gotoxy(target.x+1,target.y+3);
write(‘ ‘);
gotoxy(target.x+1,target.y+1);
write(‘ ‘);
gotoxy(target.x+1,target.y-1);
write(‘ ‘);
gotoxy(target.x,target.y);
write(‘ ‘);
textbackground(red);
gotoxy(target.x+8,target.y-3);
write(‘½’);
gotoxy(target.x+8,target.y+3);
write(‘·’);
gotoxy(target.x+6,target.y);
write(‘ֽ’);
gotoxy(target.x+3,target.y);
write(‘ֽ’);
gotoxy(target.x+3,target.y+6);
write(‘ִ’);
gotoxy(target.x+3,target.y-6);
write(‘ִ’);
gotoxy(target.x+1,target.y-5);
write(‘ײ’);
gotoxy(target.x+1,target.y+5);
write(‘׃’);
gotoxy(target.x+1,target.y+2);
write(‘ײ’);
gotoxy(target.x+1,target.y-2);
write(‘׃’);
gotoxy(target.x,target.y);
write(‘ֽ’);
textbackground(black);
end;
if stage=3 then
begin
gotoxy(target.x+8,target.y-3);
write(‘ ‘);
gotoxy(target.x+8,target.y+3);
write(‘ ‘);
gotoxy(target.x+6,target.y);
write(‘ ‘);
gotoxy(target.x+3,target.y);
write(‘ ‘);
gotoxy(target.x+3,target.y+6);
write(‘ ‘);
gotoxy(target.x+3,target.y-6);
write(‘ ‘);
gotoxy(target.x+1,target.y-5);
write(‘ ‘);
gotoxy(target.x+1,target.y+5);
write(‘ ‘);
gotoxy(target.x+1,target.y+2);
write(‘ ‘);
gotoxy(target.x+1,target.y-2);
write(‘ ‘);
gotoxy(target.x,target.y);
write(‘ ‘);
target.x:=74;
target.w:=chr(random(3)+1);
target.y:=random(15)+7;
inc(c_hit);
gotoxy(74,1);
write(c_hit);
end;
end;
begin {main}
clrscr;
level:=’1′;
c_shoot:=2500;
c_hit:=0;
list_init(l_bulet);
tank.x:=39;
tank.y:=24;
tank.w:=’8′;
d:=’4′;
target.x:=74;
target.y:=20;
target.w:=chr(3);
speed:=60;
repeat;
if (d=’5′) and (c_shoot0) then
begin
add_unit(l_bulet);
q:=last_unit(l_bulet);
q^.info.x:=tank.x;
q^.info.y:=tank.y-1;
q^.info.w:=tank.w;
dec(c_shoot);
gotoxy(2,1);
write(‘ ‘);
gotoxy(1,1);
write(c_shoot);
end
else if (d=’4′) or (d=’6′) then
m_tank(d, tank)
else if (d=’7′) or (d=’8′) or (d=’9′) then
tank.w:=d;
repeat;
if not list_empty(l_bulet) then
begin
if level=’1′ then
i:=1
else
i:=ord(target.w);
while i1 then
begin
if (stage>0) and (stage1) do
begin
m_target(target);
inc(i);
if check_hit(target, l_bulet) then
stage:=1;
end;
end;
end
else
begin
gotoxy(target.x+1, target.y-1);
write(‘ ‘);
gotoxy(target.x, target.y);
write(‘ ‘);
gotoxy(target.x+1, target.y+1);
write(‘ ‘);
end;
until (keypressed);
d:=readkey;
until d=’`’;
end.

כתיבת תגובה

האימייל לא יוצג באתר. שדות החובה מסומנים *

*

צ\'אט
  • JJ
    JJJ
    20 October 2020
  • ד
    דינה אקסלרוד
    29 September 2020
  • רעות אהרון
    גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי גל דרומי
    29 September 2020
  • ד
    גכגכ
    29 September 2020
  • דן ביקלס
    @sagi_amram
    29 September 2020
  • דן ביקלס
    תעקבו אחריי באינסטגרם
    29 September 2020
  • יניב דמוך
    מישהו רואה אותי?
    29 September 2020
  • מאיר כץ
    שלום לכם חברים בבקשה תעקבו אחרי באינשטוס @davidkatz
    29 September 2020
  • אח של דימה
    בואנה יבן של זונה תסתום תפה המזדיין שלך דימה יילד זין שרמוט
    29 September 2020
  • בודהה
    חברה איפה אהבת החינם שלכם?
    25 September 2020
Your Shout