From 0ee18ed52cb02fe12ca779ce786241da392f0ba0 Mon Sep 17 00:00:00 2001 From: "296289990@qq.com" <296289990@qq.com> Date: Tue, 8 Jan 2019 13:56:00 +0800 Subject: [PATCH] first commit --- 俄罗斯方块.c | 145 +++++++++++++++++++++++++++++++++++++++++++++- 俄罗斯方块.o | Bin 18562 -> 20852 bytes 2 files changed, 142 insertions(+), 3 deletions(-) diff --git a/俄罗斯方块.c b/俄罗斯方块.c index a0675c1..519ae73 100644 --- a/俄罗斯方块.c +++ b/俄罗斯方块.c @@ -334,7 +334,7 @@ void MakeTetris(struct Tetris *tetris){ /******ӡ˹*******/ -void PrintfTetris(struct Tetris *tetris){ +void PrintTetris(struct Tetris *tetris){ for(i=0;i<4;i++) b[i]=1; MakeTetris(tetris); for(i=tetris->x-2;i<=tetris->x+4;i+=2){ @@ -367,7 +367,7 @@ void PrintfTetris(struct Tetris *tetris){ /******жϷܷƶ******/ int ifMove(struct Tetris *tetris) { - if(a[tetris->flag][tetris->y]!=0){ + if(a[tetris->x][tetris->y]!=0){ return 0; } else{ @@ -436,7 +436,7 @@ void CleanTetris(struct Tetris *tetris){ /*******жǷ********/ -void Del_Fulline(struct Tetris *tetris){ +void Del_Fullline(struct Tetris *tetris){ int k,del_rows=0; for(j=FrameY+Frame_height-1;j>=FrameY+1;j--){ k=0; @@ -486,6 +486,145 @@ void Flag(struct Tetris *tetris){ } +/*******ʼϷ*******/ +void Gameplay(){ + int n; + struct Tetris t,*tetris=&t; + char ch; + tetris->number=0; + tetris->speed=300; + tetris->score=0; + tetris->level=1; + while(1){ + Flag(tetris); + Temp=tetris->flag; + tetris->x=FrameX+2*Frame_width+6; + tetris->y=FrameY+10; + tetris->flag=tetris->next; + PrintTetris(tetris); + tetris->x=FrameX+Frame_width; + tetris->y=FrameY-1; + tetris->flag=Temp; + /******ȡ̰*******/ + while(1){ + label:PrintTetris(tetris); + Sleep(tetris->speed);//ʱ + CleanTetris(tetris); + Temp1=tetris->x; + Temp2+tetris->flag; + if(kbhit()){ + ch=getch(); + if(ch==75){ + tetris->x-=2; // + } + if(ch==77) tetris->x+=2;// + if(ch==80){ // + if(ifMove(tetris)!=0) tetris->y+=2; + else tetris->y=FrameY+Frame_height-2; + } + if(ch==72){ + if(tetris->flag>=2&&tetris->flag<=3){ + tetris->flag++; + tetris->flag%=2; + tetris->flag+=2; + }//ֱ߷ + if(tetris->flag>=4&&tetris->flag<=7){ + tetris->flag++; + tetris->flag%=4; + tetris->flag+=4; + }//Tַ + if(tetris->flag>=8&&tetris->flag<=11){ + tetris->flag++; + tetris->flag%=4; + tetris->flag+=8; + }//Zַ + if(tetris->flag>=12&&tetris->flag<=15){ + tetris->flag++; + tetris->flag%=4; + tetris->flag+=12; + }// 7ַ + if(tetris->flag>=16&&tetris->flag<=19){ + tetris->flag++; + tetris->flag%=4; + tetris->flag+=16; + }//7ַ + } + if(ch==32) //ոͣ + { + PrintTetris(tetris); + while(1){ + if(kbhit()){ + ch=getch(); + if(ch==32) goto label; + } + } + } + if(ch==27){ //ESC˳Ϸ + system("cls"); + memset(a,0,6400*sizeof(int));//ʼ + welcome(); + } + if(ifMove(tetris)==0){ + tetris->x=Temp1; + tetris->flag=Temp2; + } + else{ + goto label; + } + } + tetris->y++; + if(ifMove(tetris)==0){ + tetris->y--; + PrintTetris(tetris); + Del_Fullline(tetris); + break; + } + } + //Ϸ + for(i=tetris->y-2;iy+2;i++){ + if(i==FrameY){ + system("cls"); + gotoxy(29,7); + printf(" \n"); + color(12); + printf("\t\t\t \n"); + + printf("\t\t\t \n"); + + printf("\t\t\t \n"); + + printf("\t\t\t \n"); + + printf("\t\t\t \n"); + gotoxy(17,18); + color(14); + printf("Ҫһ---------1"); + gotoxy(44,18); + printf("ˣ˳-----------2\n"); + int n; + gotoxy(32,20); + printf("ѡ1/2"); + color(11); + scanf("%d",&n); + switch(n){ + case 1: + system("cls"); + Replay(tetris); + break; + case 2: + exit(0); + break; + } + } + } + tetris->flag=tetris->next; + tetris->x=FrameX+2*Frame_width+6; + tetris->y=FrameY+10; + CleanTetris(tetris); + } +} + + /**************/ int main(){ title(); diff --git a/俄罗斯方块.o b/俄罗斯方块.o index 077897df87e50662dc0b73c4a61e3a2877266ae6..52df586c3516090d8fb11010379ae6e087643296 100644 GIT binary patch literal 20852 zcmd5^3v^UPw!NKnAVQ#{1Y{7$fZ*^6A$uK{F_l+;-7$T2=Nm}6rzHoj?Q9S$|MF9zeJ7l_Nmi%_w5j7aYLTkkiPrw zbLv!`I#qRVpIhApHzZr~T78aXWgFzRGDE>7A%pd;exhZ~@BpiV^&oJ%6}T+3ATN~X z(CZB5Sb_S?xn*T>vVyoXbF$1@T%TD`8q5#G* zUQXuXc)eB7n|PvS&HlaG`W+6imy=l4SzVdEi!YDKa$(#G`13kvS=s0&IjAg z^HKS_M4-Cg%ITfbmYP0*RAGIRKFadLv5=4-56cds=x) z-KmfpqpbrguWj=Q-*$3&3Od=01xT$**av$`MO|fXJ5YOC#UtuMrnn%^)cr=x%*H7S z4iSt$OGP8(bc%{HC^{TSON~$wCRMbQ5t&kbR5Y2Q0aB{JoPODE>N?97`D=2&_JtDy0Icr6XwR zuc{QYBx{Z;?S@Fh{*Wpyqb1W*rcIkvbTdUVd$jx$D!Q8@vk3H&)7!+f8K-Bd(j)Oo zW9771MSrG9hN#Y|^HsDuUSvw0sG=urQDf3w@LPJVF=^n*iu^TZEo?M&>!j#u#Hy_C zV^%5*Dy|RuRjl~;^_u|Q@tx_}1J=I=t9IAxcdlLOeq70LjY^G}_o&v#=LMpD?RBUjIeH$g&IlO!hy-M$@q z-6&~;pR62pPp!$p0%k^D#P4<2082tH#yXgB>4!D7#;bf0PUno<`>wc^Db`6p^T-^7dt!~<$-94jv2)ya$0mu3*qw{dQ|jHN zyMArn9pcA<5I)hXYuC5_+FU!p&~_2HJMfuXy?f}>sCV5z>0(3bXP$Ixks(m;UTyjH z#m;d_iS>|+*u9U>;_6*&!Xu)r*b*%kK)6P&K)zRo(DLElq zg3Gquv2i(^#EO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