資源簡介
跑跑卡丁車
已更新五個版本,建議使用最后一個版本
有不懂或發現bug的可以聯系作者
請在征求作者意見的情況下再轉載謝謝
代碼片段和文件信息
#include
#include
#include
#define?KEY_DOWN(VK_NONAME)?((GetAsyncKeyState(VK_NONAME)?&?0x8000)???1:0)
#define?cls?system(“cls“)
#define?pause?system(“pause“)
using?namespace?std;
const?int?n=5m=30;
int?game[4][10][40];
void?color(int?a){
????SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE)a);
????/*
????yle=“white-space:pre“>????字
????????1???深藍色
????????2???深綠色
????????3???深青色
????????4???深紅色
????????5???深粉色
????????6???黃色
????????7???深白色
????????8???灰色
????????9???淺藍色
????????10??淺綠色
????????11??淺青色
????????12??淺紅色
????????13??淺粉色
????????14??淺黃色
????????15??淺白色
????*/
}
void?gotoXY(int?xint?y){
COORD?pos;
pos.X?=?y;
pos.Y?=?x;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE)pos);
}
void?print(string?sao){
for(int?i=0;i printf(“%c“sao[i]);
Sleep(30);
}
}
void?fail(int?p1int?p2);
int?main(){
srand(time(0));
cls;
color(15);
print(“歡迎來到KDR的跑跑卡丁車\n“);
Sleep(1000);
cls;
print(“三秒后游戲開始\n“);
Sleep(500);
cls;
printf(“3“);
Sleep(1000);
cls;
printf(“2“);
Sleep(1000);
cls;
printf(“1“);
Sleep(1000);
cls;
int?place1=3place2=3;//當前位置
int?point1=0point2=0;//當前分數?
int?hard=150;//當前難度?
int?sao=5;//當前刷新頻率?
bool?flag1=0flag2=0;//當前輸贏情況?
int?t=1;?
memset(game0sizeof(game));
printf(“--------------------------------???--------------------------------\n“);
printf(“|??????????????????????????????|???|??????????????????????????????|\n“);
printf(“|??????????????????????????????|???|??????????????????????????????|\n“);
printf(“|??????????????????????????????|???|??????????????????????????????|\n“);
printf(“|??????????????????????????????|???|??????????????????????????????|\n“);
printf(“|??????????????????????????????|???|??????????????????????????????|\n“);
printf(“--------------------------------???--------------------------------\n“);
int?x;
for(int?i=0;i<1;i++){
x=rand()%n+1;
game[i][x][11]=2;
x=rand()%n+1;
game[i][x][16]=2;
x=rand()%n+1;
game[i][x][21]=2;
x=rand()%n+1;
game[i][x][26]=2;
}
color(12);
gotoXY(place11);
printf(“?“);
gotoXY(place236);
printf(“?“);
gotoXY(100);
printf(“P1:ws操控P2:ik操控“);
while(t){
for(int?k=0;k<1;k++){
for(int?i=1;i<=n;i++)
if(game[k][i][1]==1){
if(!flag1){
point1++;
gotoXY(i+6*k1);
printf(“?“);
if(point1%10==0&&hard!=20)hard-=5;
if(point1%50==0&&sao!=3)sao--;
}
if(!flag2){
point2++;
gotoXY(i+6*k36);
printf(“?“);
if(point2%10==0&&hard!=20&&flag1)hard-=5;
if(point2%50==0&&sao!=3&&flag1)sao--;
}
}
}
for(int?k=0;k<1;k++){
for(int?i=1;i<=n;i++){
for(int?j=1;j<=m;j++)game[k][i][j]=game[k][i][j+1];
}
}
t--;
if(t==0)t=saox=rand()%n+1game[0][x][m]=1;
if(game[0][place1][1]==1)flag1=1;
if(game[0][place2][1]==1)flag2=1;
for(int?k=0;k<1;k++){
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????7483??2020-10-03?09:56??跑跑卡丁車\跑跑卡丁車-1-雙人.cpp
?????文件???????4514??2020-09-23?14:01??跑跑卡丁車\跑跑卡丁車-1.cpp
?????文件???????8579??2020-10-03?10:04??跑跑卡丁車\跑跑卡丁車-2-雙人.cpp
?????文件???????4922??2020-09-23?13:59??跑跑卡丁車\跑跑卡丁車-2.cpp
?????文件???????9921??2020-10-03?10:08??跑跑卡丁車\跑跑卡丁車-3-雙人.cpp
?????文件???????5328??2020-09-23?14:00??跑跑卡丁車\跑跑卡丁車-3.cpp
?????文件??????11263??2020-10-03?10:12??跑跑卡丁車\跑跑卡丁車-4-雙人.cpp
?????文件???????5734??2020-09-23?14:01??跑跑卡丁車\跑跑卡丁車-4.cpp
?????文件????????167??2020-09-23?12:39??跑跑卡丁車\跑跑卡丁車1.0.0\更新公告.txt
?????文件????1864215??2020-09-23?12:37??跑跑卡丁車\跑跑卡丁車1.0.0\跑跑卡丁車1.0.0.exe
?????文件????????145??2020-09-23?13:05??跑跑卡丁車\跑跑卡丁車1.0.1\更新公告.txt
?????文件????1864727??2020-09-23?13:03??跑跑卡丁車\跑跑卡丁車1.0.1\跑跑卡丁車1.0.1-1.exe
?????文件????1865239??2020-09-23?13:00??跑跑卡丁車\跑跑卡丁車1.0.1\跑跑卡丁車1.0.1-2.exe
?????文件????1865239??2020-09-23?12:57??跑跑卡丁車\跑跑卡丁車1.0.1\跑跑卡丁車1.0.1-3.exe
?????文件????1865751??2020-09-23?12:55??跑跑卡丁車\跑跑卡丁車1.0.1\跑跑卡丁車1.0.1-4.exe
?????文件????????116??2020-09-23?14:03??跑跑卡丁車\跑跑卡丁車1.0.2\更新公告.txt
?????文件????1864727??2020-09-23?14:01??跑跑卡丁車\跑跑卡丁車1.0.2\跑跑卡丁車1.0.2-1.exe
?????文件????1865239??2020-09-23?13:59??跑跑卡丁車\跑跑卡丁車1.0.2\跑跑卡丁車1.0.2-2.exe
?????文件????1865239??2020-09-23?14:00??跑跑卡丁車\跑跑卡丁車1.0.2\跑跑卡丁車1.0.2-3.exe
?????文件????1865751??2020-09-23?14:01??跑跑卡丁車\跑跑卡丁車1.0.2\跑跑卡丁車1.0.2-4.exe
?????文件????????126??2020-10-03?10:17??跑跑卡丁車\跑跑卡丁車1.0.3\更新公告.txt
?????文件????1934837??2020-10-03?09:56??跑跑卡丁車\跑跑卡丁車1.0.3\跑跑卡丁車1.0.3-1-雙人.exe
?????文件????1864727??2020-09-23?14:01??跑跑卡丁車\跑跑卡丁車1.0.3\跑跑卡丁車1.0.3-1.exe
?????文件????1935349??2020-10-03?10:05??跑跑卡丁車\跑跑卡丁車1.0.3\跑跑卡丁車1.0.3-2-雙人.exe
?????文件????1865239??2020-09-23?13:59??跑跑卡丁車\跑跑卡丁車1.0.3\跑跑卡丁車1.0.3-2.exe
?????文件????1935861??2020-10-03?10:08??跑跑卡丁車\跑跑卡丁車1.0.3\跑跑卡丁車1.0.3-3-雙人.exe
?????文件????1865239??2020-09-23?14:00??跑跑卡丁車\跑跑卡丁車1.0.3\跑跑卡丁車1.0.3-3.exe
?????文件????1936373??2020-10-03?10:12??跑跑卡丁車\跑跑卡丁車1.0.3\跑跑卡丁車1.0.3-4-雙人.exe
?????文件????1865751??2020-09-23?14:01??跑跑卡丁車\跑跑卡丁車1.0.3\跑跑卡丁車1.0.3-4.exe
?????文件?????????73??2020-09-22?14:15??跑跑卡丁車\跑跑卡丁車內測版\更新公告.txt
............此處省略10個文件信息
- 上一篇:C語言優先級
- 下一篇:c++ 掃雷游戲源碼(控制臺)
評論
共有 條評論