MN xem hộ em sai ở đâu với, sửa luôn giúp em ạ
program gameball;
uses crt,KEY;
var h1,h2,h3,h4,banh1,banh2,can1,can2,chay1,chay2,i : integer;
diem,mang,gach1,gach2,phim,chon,dokho,muiten:integer;
chondokho : integer;
label thoat;
procedure banh;
begin
CLRSCR;
for i:=20 to 62 do begin
gotoxy(i,7);
write('__');
end;
for i:=8 to 20 do begin
gotoxy(20,i);
write('|');
end;
for i:=20 to 62 do begin
gotoxy(i,20);
write('__'); {IN giao dien game}
end;
for i:=8 to 20 do begin
gotoxy(62,i);
write('|');
end;
gotoxy(30,8);
Write('BOUNCING BALL I');
GOTOXY(25,11);
write('CHAO MUNG DEN VOI GAME BOUNCING BALL');
GOTOXY(25,13);
WRITE('DUNG PHIM "<-" DE DI CHUYEN SANG TRAI');
GOTOXY(25,14);
WRITE('DUNG PHIM "->" DE DI CHUYEN SANG PHAI');
gotoxy(25,15);
write('DUNG PHIM "ESC" DE THOAT [ QUIT ] ');
GOTOXY(25,17);
WRITE('NHAN ENTER DE BAT DAU CHOI !');
GOTOXY(25,19);
WRITE('--> ENTER !');
GOTOXY(25,23);
write('WRITE BY HACK258147');
READLN;
clrscr;
diem:=0;
banh1:=40 ; banh2:=18; {toa do cua banh}
gotoxy(banh1,banh2);
write('o'); {in banh}
{ Phan Choi game }
h2:=7;
for h1:=3 to 19 do begin
gotoxy(h2,h1);
write('//');
end;
h4:=67;
for h3:=3 to 19 do begin
gotoxy(h4,h3);
write('//');
end;
for h2:=7 to 67 do begin
gotoxy(h2,2);
write('//');
end;
for h2:=7 to 67 do begin
gotoxy(h2,20);
write('//');
end;
gotoxy(70,3);
write('BOUNCING');
GOTOXY(70,4);
WRITE('BALL I');
FOR i:=5 to 20 do begin
gotoxy(70,i);
write('/////////'); end;
{phan tao gach}
for i:=12 to 62 do begin
gotoxy(i,3);
write('');
end;
for i:=12 to 62 do begin
gotoxy(i,4);
write('');
end;
for i:=12 to 62 do begin
gotoxy(i,5);
write('');
end;
for i:=12 to 62 do begin
gotoxy(i,6);
write('');
end;
end;
procedure chaybanh;
label top,thoat,tiep,tiep2,chinhdokho,dieukhien;
begin
can1:=39;
can2:=19; {39,19}
gotoxy(30,24);
write('ESC : Thoat game');
gotoxy(50,24);
write('Write By hack258147');
gotoxy(50,25);
write('diendantoanhoc.net');
mang:=3;
top:
chay1:=0;
chay2:=-1;
gotoxy(5,25);
write('Mang : ',mang);
gotoxy(banh1,banh2);
write(' ');
banh1:=40;
banh2:=18;
gotoxy(5,24);
write('Diem : ',diem);
if chondokho=enterkey then goto tiep;
muiten:=13;
chinhdokho:
gotoxy(10,12);
write('Chon do kho');
gotoxy(14,13);
write('De');
gotoxy(14,14);
write('Binh thuong');
gotoxy(14,15);
write('Kho');
gotoxy(10,muiten);
write('-->');
dokho:=getkey;
keypressed;
repeat
if (dokho=upkey) and (muiten=13) then goto chinhdokho;
if (dokho=upkey) then begin
gotoxy(10,muiten);
write(' ');
muiten:=muiten-1;
gotoxy(10,muiten);
write('-->');
end;
if (dokho=dnkey) and (muiten=15) then goto chinhdokho;
if (dokho=dnkey) then begin
gotoxy(10,muiten);
write(' ');
muiten:=muiten+1;
gotoxy(10,muiten);write('-->'); end;
chondokho:=getkey;
if chondokho=enterkey then begin
gotoxy(10,12);
write(' ');
gotoxy(14,13);
write(' ');
gotoxy(14,14);
write(' ');
gotoxy(14,15);
write(' ');
gotoxy(10,muiten);
write(' ');
end;
until (chondokho=enterkey);
tiep:
repeat
if muiten=13 then delay(50000);
if muiten=14 then delay(40000);
if muiten=15 then delay(30000);
gotoxy(banh1,banh2); {CT chay Banh}
write(' ');
banh1:=banh1+chay1;
banh2:=banh2+chay2;
gotoxy(banh1,banh2);
write('o');
gotoxy(can1,can2);
write('MMMM');
if keypressed then begin
dieukhien:
phim:=Getkey;
tiep2: {39:19 toa do cua can}
if phim=leftkey then begin
gotoxy(can1,can2);
write(' '); {dieu khien can qua trai}
can1:=can1-3;
if (can1=9) and (can2=19) then can1:=can1+3;
gotoxy(can1,can2);
write('MMMM');
end;
if phim=rightkey then begin
gotoxy(can1,can2);
write(' '); {dieu khien can qua phai}
can1:=can1+3;
if (can1=66) and (can2=19) then can1:=can1-3;
gotoxy(can1,can2);
write('MMMM');
end;
end;
if phim=inskey then begin
mang:=9999;
gotoxy(5,25);
write(' '); {hack mang}
gotoxy(5,25);
write('Mang : ',mang);
end;
if phim=homekey then begin
diem:=9999;
gotoxy(5,24);
write(' '); {hack diem}
gotoxy(5,24);
write('Diem : ',diem);
end;
if (can1=banh1) and (can2=banh2) then begin
diem:=diem+1;
gotoxy(5,24);
write(' ');
gotoxy(5,24);
write('Diem : ',diem);
gotoxy(can1,can2);
write('M');
chay1:=random(3);
if chay1 = 1 then chay1:=+1;
if chay1 = 2 then chay1:=-1;
if chay1 = 3 then chay1:=+1;
if chay1 = 0 then chay1:=-1; {banh trung can_1}
chay2:=-1;
gotoxy(can1,can2);
write('M');
end;
if (can1+1=banh1) and (can2=banh2) then begin
diem:=diem+1;
gotoxy(5,24);
write(' ');
gotoxy(5,24);
write('Diem : ',diem);
gotoxy(can1+1,can2);
write('M');
chay1:=random(3);
if chay1 = 1 then chay1:=+1;
if chay1 = 2 then chay1:=-1;
if chay1 = 3 then chay1:=+1;
if chay1 = 0 then chay1:=-1;
{banh trung can 2}
chay2:=-1;
gotoxy(can1+1,can2);
write('M');
end;
if (can1+2=banh1) and (can2=banh2) then begin
diem:=diem+1;
gotoxy(5,24);
write(' ');
gotoxy(5,24);
write('Diem : ',diem);
gotoxy(can1,can2);
write('M');
chay1:=random(3);
if chay1 = 1 then chay1:=+1;
if chay1 = 2 then chay1:=-1;
if chay1 = 3 then chay1:=+1;
if chay1 = 0 then chay1:=-1; {banh trung can 3}
chay2:=-1;
gotoxy(can1+2,can2);
write('M');
end;
if (can1+3=banh1) and (can2=banh2) then begin
diem:=diem+1;
gotoxy(5,24);
write(' ');
gotoxy(5,24);
write('Diem : ',diem);
gotoxy(can1+3,can2);
write('M');
chay1:=random(3);
if chay1 = 1 then chay1:=+1;
if chay1 = 2 then chay1:=-1;
if chay1 = 3 then chay1:=+1;
if chay1 = 0 then chay1:=-1;
{banh trung can 4}
chay2:=-1;
gotoxy(can1+3,can2);
write('M');
end;
{ 9:2/ toa do ban dau cua banh }
for i:=8 to 66 do begin
if (banh1=i) and (banh2=3) then begin {neu banh dung tuong tren}
chay1:=random(3) ;
if chay1 = 1 then chay1:=+1;
if chay1 = 2 then chay1:=-1;
if chay1 = 3 then chay1:=+1;
if chay1 = 0 then chay1:=-1;
chay2:=+1; end; {66:3}
end;
for i:=4 to 20 do begin
if (banh2=i) and (banh1=10) then begin {neu banh dung tuong trai}
chay1:=+1;
randomize;
chay2:=random(3);
if chay2 = 1 then chay2:=+1;
if chay2 = 2 then chay2:=-1;
if chay2 = 3 then chay2:=+1;
if chay2 = 0 then chay2:=-1; end;
end; {9:3:19}
for i:=4 to 19 do begin
if (banh2=i) and (banh1=66) then begin
chay1:=-1;
randomize;
chay2:=random(3); {neu banh dung tuong phai}
if chay2 = 1 then chay2:=+1;
if chay2 = 2 then chay2:=-1;
if chay2 = 3 then chay2:=+1;
if chay2 = 0 then chay2:=-1;end;
end;
for i:=9 to 66 do begin
if (banh1<>can1) and (banh1<>can1+1) and (banh1<>can1+2) and (banh1<>can1+3) then begin
if (banh2=19) and (banh1=i) then begin
delay(60000);
delay(60000);
mang:=mang-1; {neu banh dung day}
gotoxy(10,12);
write('Ban bi mat mot mang/ bam ENTER de choi tiep ');
gotoxy(10,13);
write('Nhan ESC de thoat ');
chon:=Getkey;
gotoxy(10,12);
write(' ');
gotoxy(10,13);
write(' ');
gotoxy(5,25);
write(' ');
gotoxy(5,25);
write('Mang : ',mang);
gotoxy(5,24);
write(' ');
gotoxy(5,24);
write('Diem : ',diem);
if chon=enterkey then goto top;
if chon=Esckey then exit;
if chon=rightkey then goto top;
if chon=leftkey then goto top;
if chon=upkey then goto top;
if chon=dnkey then goto top;
end;
end;
end;
if mang = -1 then begin
gotoxy(10,12);
write('GAME OVER/Nhan Esc de thoat , nhan Space de choi tiep');
gotoxy(10,13);
write('Diem cua ban : ',diem);
chon:=getkey;
gotoxy(10,12);
write(' ');
gotoxy(10,13);
write(' ');
if chon=esckey then exit;
if chon=spacekey then begin
mang:=3;
diem:=0;
gotoxy(5,25);
write(' '); {diem :24,5 / mang:25,5}
gotoxy(5,25);
write('Mang : ',mang);
gotoxy(5,24);
write('Diem : ',diem);
goto top;
end;
end;
until (phim=esckey);
end;
begin
banh;
can1:=39; { CT chinh }
can2:=19;
gotoxy(can1,can2); {in can}
write('MMMM');
chaybanh;
clrscr;
gotoxy(20,5);
write('GAME OVER /nhan Enter de thoat');
gotoxy(20,6);
write('Diem cua ban : ',diem);
readln;
end.
Bằng cách nhấp vào Đăng nhập, bạn đồng ý Chính sách bảo mật và Điều khoản sử dụng của chúng tôi. Nếu đây không phải máy tính của bạn, để đảm bảo an toàn, hãy sử dụng Cửa sổ riêng tư (Tab ẩn danh) để đăng nhập (New Private Window / New Incognito Window).
Hôm nay bạn thế nào? Hãy nhấp vào một lựa chọn, nếu may mắn bạn sẽ được tặng 50.000 xu từ Lazi
Vui | Buồn | Bình thường |