首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

俄罗斯方块程序在Vc运行老是出现下面这几个小问题,如何改一下

2013-10-24 
俄罗斯方块程序在Vc运行老是出现下面这几个问题,怎么改一下?}y+BSIZExls_x}}void main(){int GameOver

俄罗斯方块程序在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 c++
[解决办法]
在BC++3.1下编译运行。
http://download.csdn.net/source/2805028

热点排行