俄罗斯方块程序在Vc运行老是出现下面这几个问题,怎么改一下?
}
y+=BSIZE;
x=ls_x;
}
}
void main()
{
int GameOver=0;
int key,nextbox;
int Currentaction=0;/*标记当前动作状态*/
int gd=VGA,gm=VGAHI,errorcode;
initgraph(&gd,&gm,"");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("\nNotice:Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to quit!");
getch();
exit(1);
}
setbkcolor(BgColor);
setcolor(FgColor);
randomize();
SetTimer(newtimer);
initialize(Sys_x,Sys_y,Horizontal_boxs,Vertical_boxs);/*初始化*/
nextbox=MkNextBox(-1);
show_box(Curbox_x,Curbox_y,current_box_numb,shapes[current_box_numb].color);
show_box(LeftWin_x,Curbox_y+200,nextbox,shapes[nextbox].color);
show_intro(Sys_x,Curbox_y+320);
getch();
while(1)
{
/* Currentaction=0;
flag_newbox=false;
检测是否有按键*/
if (bioskey(1)){key=bioskey(0); }
else { key=0; }
switch(key)
{
case VK_LEFT:
if(MoveAble(Curbox_x,Curbox_y,current_box_numb,MoveLeft))
{EraseBox(Curbox_x,Curbox_y,current_box_numb);Curbox_x-=BSIZE;Currentaction=MoveLeft;}
break;
case VK_RIGHT:
if(MoveAble(Curbox_x,Curbox_y,current_box_numb,MoveRight))
{EraseBox(Curbox_x,Curbox_y,current_box_numb);Curbox_x+=BSIZE;Currentaction=MoveRight;}
break;
case VK_DOWN:
if(MoveAble(Curbox_x,Curbox_y,current_box_numb,MoveDown))
{EraseBox(Curbox_x,Curbox_y,current_box_numb);Curbox_y+=BSIZE;Currentaction=MoveDown;}
else flag_newbox=true;
break;
case VK_UP:/*旋转方块*/
if(MoveAble(Curbox_x,Curbox_y,shapes[current_box_numb].next,MoveRoll))
{EraseBox(Curbox_x,Curbox_y,current_box_numb);current_box_numb=shapes[current_box_numb].next;
Currentaction=MoveRoll;
}
break;
case VK_ESC:
GameOver=1;
break;
default:
break;
}
if(Currentaction)
{ /*表示当前有动作,移动或转动*/
show_box(Curbox_x,Curbox_y,current_box_numb,shapes[current_box_numb].color);
Currentaction=0;
}
/*按了往下键,但不能下移,就产生新方块*/
if(flag_newbox)
{
/*这时相当于方块到底部了,把其中出现点满一行的清去,置0*/
ErasePreBox(LeftWin_x,Sys_y+200,nextbox);
nextbox=MkNextBox(nextbox);
show_box(LeftWin_x,Curbox_y+200,nextbox,shapes[nextbox].color);
if(!MoveAble(Curbox_x,Curbox_y,current_box_numb,MoveDown))/*刚一开始,游戏结束*/
{
show_box(Curbox_x,Curbox_y,current_box_numb,shapes[current_box_numb].color);
GameOver=1;
}
else
{
flag_newbox=false;
}
Currentaction=0;
}
else /*自由下落*/
{
if (Currentaction==MoveDown || TimerCounter> (20-speed*2))
{
if(MoveAble(Curbox_x,Curbox_y,current_box_numb,MoveDown))
{
EraseBox(Curbox_x,Curbox_y,current_box_numb);Curbox_y+=BSIZE;
show_box(Curbox_x,Curbox_y,current_box_numb,shapes[current_box_numb].color);
}
TimerCounter=0;
}
}
if(GameOver )/*|| flag_newbox==-1*/
{
printf("game over,thank you! your score is %d",score);
getch();
break;
}
}
getch();
KillTimer();
closegraph();
}
D:\demo\demo.cpp(47) : error C2065: 'oldtimer' : undeclared identifier
D:\demo\demo.cpp(47) : error C2100: illegal indirection
D:\demo\demo.cpp(47) : error C2501: 'interrupt' : missing storage-class or type specifiers
D:\demo\demo.cpp(47) : error C2143: syntax error : missing ';' before '('
D:\demo\demo.cpp(47) : error C2062: type 'void' unexpected
D:\demo\demo.cpp(47) : error C2059: syntax error : ')'
D:\demo\demo.cpp(141) : error C2146: syntax error : missing ';' before identifier 'newtimer'
D:\demo\demo.cpp(141) : error C2182: 'interrupt' : illegal use of type 'void'
D:\demo\demo.cpp(141) : error C2086: 'interrupt' : redefinition
D:\demo\demo.cpp(141) : fatal error C1004: unexpected end of file found
相关推荐
用C语言编写的在VC6.0环境下运行的俄罗斯方块程序
用C语言编写的在VC6.0环境下运行的俄罗斯方块程序
在VC下运行的俄罗斯方块程序
对初这者来说很有用!文件名:main.cpp #include #include #include using namespace std; #include "gobangPlayer.h" /************************************************ ** Function Declaration Beginning */ void displayInformation(void); /******************************************* ** 函数名: displayInformation ** 功能: 打印信息 ** 参数: void ** 返回值: void *********************************************/ bool isPlayAgain(void); /******************************************* ** 函数名: isPlayAgain ** 功能: 询问是否继续游戏 ** 参数: void ** 返回值: bool 如果继续游戏, 返回true, 否则返回flase *********************************************/ char getChoice(void); /******************************************* ** 函数名: getChoice ** 功能: 决定先手还是后手 ** 参数: void ** 返回值: char 先下, 返回'1'; 后下, 返回'2'
VC程序俄罗斯方块
这是一个简单的俄罗斯方块,基于VC++6.0制作,双人版,界面未优化。
用VC编写俄罗斯方块程序
通过 一个简单的 游戏程序 可以让你对vc有更深刻的认识和理解
用VC写的俄罗斯方块程序源码
一个用VC写的俄罗斯方块程序源码 一个用VC写的俄罗斯方块程序源码


