文件名称:C++贪食蛇游戏
文件大小:1.66MB
文件格式:ZIP
更新时间:2016-07-06 13:41:46
语言C++
简单的C++贪食蛇游戏 #include "declare.h" extern int speed; void ChargeDir(Snake_Dir* Dir,Snake_Dir* Dir_,int& temp,int& tempS){ int c; if(kbhit()){ c = getch(); if(c == 224)c = getch(); char flag; switch(c){ // case 27: // return;break; case '5': while(flag != '5'){ if(kbhit()) flag = getch(); } flag = 0; break; case '+': if(speed>100||tempS>100){temp = tempS;tempS = speed;speed = temp;}break; case 75: case '4': if(*Dir != Right){*Dir = Left;}break; case 77: case '6': if(*Dir != Left){*Dir = Right;}break; case 72: case '8': if(*Dir != Down){*Dir = Up;}break; case 80: case '2': if(*Dir != Up){*Dir = Down;}break; case '7': if(*Dir != RightDown){*Dir = LeftUp;}break; case '9': if(*Dir != LeftDown){*Dir = RightUp;}break; case '1': if(*Dir != RightUp){*Dir = LeftDown;}break; case '3': if(*Dir != LeftUp){*Dir = RightDown;}break; case 's': if(*Dir_ != Up){*Dir_ = Down;}break; case 'a': if(*Dir_ != Right){*Dir_ = Left;}break; case 'w': if(*Dir_ != Down){*Dir_ = Up;}break; case 'd': if(*Dir_ != Left){*Dir_ = Right;}break; } } // return Dir; }
【文件预览】:
贪食蛇
----Snake()
--------clearSnake.cpp(181B)
--------Bar.h(46B)
--------scene.cpp(1KB)
--------CreateProps.cpp(0B)
--------Snake.dsp(5KB)
--------declare.h(914B)
--------CreateBar.cpp(987B)
--------Snake.h(80B)
--------Debug()
--------Food.h(56B)
--------ifEatFood.cpp(666B)
--------SelectGame.cpp(1KB)
--------SnakeMove.cpp(2KB)
--------ifDead.cpp(2KB)
--------ifMeetBar.cpp(894B)
--------Props.h(48B)
--------CreateFood.cpp(1KB)
--------Snake.dsw(518B)
--------Snake.plg(2KB)
--------Help.cpp(2KB)
--------main.cpp(2KB)
--------printIf.cpp(503B)
--------ChangeDir.cpp(1KB)
--------Snake.opt(54KB)
--------cover.cpp(1KB)
--------gotoPoint.cpp(196B)
--------Snake.ncb(241KB)