改了一些变量名
用了b_game.h2.0
把下面的文件放在一个文件夹里就行了
main.cpp
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>
#include <ctime>
#include <windows.h>
#include <conio.h>
#include <fstream>
#include <stdio.h>
#include "b_game.h"
using namespace std;
using namespace cd;
using namespace shuchu;
using namespace sb_gb;
using namespace yanse;
const long long dts = 8;
long long wj1x, wj1y, wj2x, wj2y, wj3x, wj3y, wj4x, wj4y, cs = 0, dtbh, sy, runs, cgjd = 1, y_1x, y_1y, y_2x, y_2y, y_3x, y_3y, y_4x, y_4y;
cdhs cddx;
bool f = 1, t1 = 1, t2 = 1, t3 = 1, t4 = 1, cxjs = 1;
long long csx[dts + 1] = {
0,
18,
18,
18,
14,
1,
3,
1,
3
};
long long csy[dts + 1] = {
0,
1,
1,
1,
1,
1,
1,
1,
37
};
string dtm[dts + 1] = {
"空地图",
"新手图",
"蹦床天地",
"信仰之跃",
"生死双道",
"天空跳床",
"小心暗刺",
"转来转去",
"9 9 加 6"
};
string dt[dts + 1][21] = {
{
" ",//
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
},
{
" =",//
" =",
" =",
" =",
" =",
" =",
" =",
" =",
" =",
" =",
" =",
" =",
" =",
" =",
" ===================",
" =",
" ==== =",
" = =",
" < > = $=",
" ==== ====^^^^==================- ======= =",
" ="
},
{
" ",//
" = < ",
" = < ",
" = < $ ",
" = < ",
" = < ",
" --- < ",
" = ",
" ======-=====-===---=----=-=----========-=======",
" ",
" ",
" --- ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ---------------------------------------------------------------------------",
" "
},
{
" ",//
" ",
" ",
" == === ",
" = = ",
" = = ",
" = $ = ",
" = = ",
" = = - ",
" = ",
" -== = ",
" = ",
" == = ",
" === =- ",
" == = ",
" ==== = ",
" === = ",
" == = ",
" === == ",
" = === ======-",
" ",
},
{
" ",//
" ",
" ",
" == === == ",
" === === < ",
" == < ",
" < ",
" == ==^^^^^^^^^^^== < ",
" ====== < ",
" == === ======= < ",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< ",
" == < ",
" < ",
" == < ",
" ^ $",
" ========> <=== === === == = === = == === ==== ^ ==== === == = == = =====",
" ",
" ",
" ",
" ",
" ",
},
{
" ",//
" < ",
" < ",
" < ",
" < ",
" < ",
" < --- ",
" < == ",
" < ",
" < = --- ",
" < = ",
" < = ",
" < = ",
" < = ",
" < = ",
" < = --- ",
" < = $",
" = ",
" =====---------=^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",
" ",
" "
},
{
" ",//
" =",
" =",
" =",
" ====^=====^=====^=====^=====^=====^=====^=====^=====^=====^=====^=====^== =",
" =",
" ========== <> =",
" = <> <> =",
" ==============================^^^^^^^^^^^^=============================^=",
" < =",
" < == == =",
" < = = =",
" ^^^ < = = =",
" < = = =",
" < = = =",
" ^^^^< = = =",
" < = = =",
" < = = =",
" = = =",
" ============== ===== $=",
" ="
},
{
" ",//
" < =",
" < =",
" < =",
" < ============================= =",
" < = = = = =",
" < = = = = ===================== =",
" < = == = $= == = = == =",
" < = = = = = = = =",
" < = == ^^^^== = == = ===",
" < = = = ^^^^^= = = === === =",
" < == = =============== = = =",
" < = =^^ = = == =",
" < = =========================== = === =",
" < = = = =",
" < ^ =============================== = =",
" < => ==== =",
" ==> ===",
" ==================================================================== =",
" =",
" ="
},
{
" ",//
" > < = = ",
" > < = = ",
" = > < = = = ",
" ^^^^ = > === < = == = ",
" <= > = =^ = === = ",
" < = < < =$ = ",
" < = ^^^^^^^^^^^^^^^ < = === ",
" ^^^< = ^^ =^^^^^^^^== = ",
" < = ======== ^ ============= = ",
" < = ==== === <^ = ",
" < ======^^^^^^^^^^^^^ > ^^ ================ ",
" < ^^^^ ",
" ^^^^ < == == ",
" < = ",
" < = == ",
" ==== ^^^ = ",
" = == ",
" ========== ======= ",
" ",
" "
}
};
//基础函数
void csh()
{
f = 1, t1 = 1, t2 = 1, t3 = 1, t4 = 1;
cs = 0;
return;
}
void gb()
{
CONSOLE_CURSOR_INFO cursor;
cursor.bVisible = FALSE;
cursor.dwSize = sizeof(cursor);
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorInfo(handle, &cursor);
return;
}
void out();
void in();
void lx();
void bd();
void gx();
//页面函数
void zym();
void yxym();
void smym();
void szsmym();
void wpsmym();
void yxjqym();
//模式函数
void youxi();
void suij();
void cg();
int main()
{
srand(time(0));
color(240);
system("mode con cols=76 lines=20");
gb();
cddx.in(cgjd, "闯关进度.binggan");
while (cxjs)
{
zym();
system("cls");
}
cddx.out(cgjd, "闯关进度.binggan");
return 0;
}
void zym()
{
char s;
system("cls");
gs(5, 34, "跑酷");
gs(2, 0, "");
gs(1, 30, "0.退出");
gs(1, 30, "1.开始游戏");
gs(1, 30, "2.游戏说明");
gs(1, 30, "3.游戏存档");
s = _getch();
while (s != '0' && s != '1' && s != '2' && s != '3')s = _getch();
switch (s)
{
case '0':
cxjs = 0;
return;
break;
case '1':
yxym();
break;
case '2':
smym();
break;
case '3':
cddx.out(cgjd, "闯关进度.binggan");
break;
}
return;
}
void yxym()
{
char s;
system("cls");
while (1)
{
gs(0, 0, "0.退出");
gs(1, 0, "1.单人模式");
gs(1, 0, "2.双人模式");
gs(1, 0, "3.三人模式");
gs(1, 0, "4.四人模式");
s = _getch();
while (s != '0' && s != '1' && s != '2' && s != '3' && s != '4')s = _getch();
switch (s)
{
case '0':
return;
case '1':
runs = 1;
break;
case '2':
runs = 2;
break;
case '3':
runs = 3;
break;
case '4':
runs = 4;
break;
}
youxi();
}
return;
}
void out()
{
for (long long i = 1; i <= 19; i++)
{
for (long long j = 1; j <= 75; j++)
{
if (i == wj1x && j == wj1y)
{
color(11);
cout << "*";
}
else
if (i == wj2x && j == wj2y && runs >= 2)
{
color(12);
cout << "+";
}
else
if (i == wj3x && j == wj3y && runs >= 3)
{
color(14);
cout << "!";
}
else
if (i == wj4x && j == wj4y && runs >= 4)
{
color(10);
cout << "#";
}
else
if (dt[dtbh][i][j] == '$')
{
color(7);
cout << "$";
}
else
{
color(240);
cout << dt[dtbh][i][j];
}
}
cout << endl;
}
return;
}
void in()
{
char s;
if (GetKeyState('P') < 0)
{
system("cls");
cout << "暂停中\n\n";
cout << "0.退出\n";
cout << "1.返回\n";
s = _getch();
while (s != '0' && s != '1')s = _getch();
switch (s)
{
case '0':
f = 0;
sy = 0;
return;
case '1':
out();
out();
break;
}
}
if (GetKeyState(38) < 0 && (dt[dtbh][wj1x - 1][wj1y] == ' ' || dt[dtbh][wj1x - 1][wj1y] == '$') && wj1x > 1 && t1)
{
wj1x--;
for (long long i = 1; i <= 2; i++)
if (dt[dtbh][wj1x - 1][wj1y] == ' ' && wj1x > 1)wj1x--;
t1 = 0;
}
if (GetKeyState(37) < 0 && (dt[dtbh][wj1x][wj1y - 1] == ' ' || dt[dtbh][wj1x][wj1y - 1] == '$') && wj1y - 1 > 0)
{
wj1y--;
}
if (GetKeyState(39) < 0 && (dt[dtbh][wj1x][wj1y + 1] == ' ' || dt[dtbh][wj1x][wj1y + 1] == '$') && wj1y - 1 <= 100)
{
wj1y++;
}
if (runs >= 2)
{
if (GetKeyState('W') < 0 && (dt[dtbh][wj2x - 1][wj2y] == ' ' || dt[dtbh][wj2x - 1][wj2y] == '$') && wj2x > 1 && t2)
{
wj2x--;
for (long long i = 1; i <= 2; i++)
if (dt[dtbh][wj2x - 1][wj2y] == ' ' && wj2x > 1)wj2x--;
t2 = 0;
}
if (GetKeyState('A') < 0 && (dt[dtbh][wj2x][wj2y - 1] == ' ' || dt[dtbh][wj2x][wj2y - 1] == '$') && wj2y - 1 > 0)
{
wj2y--;
}
if (GetKeyState('D') < 0 && (dt[dtbh][wj2x][wj2y + 1] == ' ' || dt[dtbh][wj2x][wj2y + 1] == '$') && wj1y - 1 <= 100)
{
wj2y++;
}
}
if (runs >= 3)
{
if (GetKeyState('I') < 0 && (dt[dtbh][wj3x - 1][wj3y] == ' ' || dt[dtbh][wj3x - 1][wj3y] == '$') && wj3x > 1 && t3)
{
wj3x--;
for (long long i = 1; i <= 2; i++)
if (dt[dtbh][wj3x - 1][wj3y] == ' ' && wj3x > 1)wj3x--;
t3 = 0;
}
if (GetKeyState('J') < 0 && (dt[dtbh][wj3x][wj3y - 1] == ' ' || dt[dtbh][wj3x][wj3y - 1] == '$') && wj3y - 1 > 0)
{
wj3y--;
}
if (GetKeyState('L') < 0 && (dt[dtbh][wj3x][wj3y + 1] == ' ' || dt[dtbh][wj3x][wj3y + 1] == '$') && wj3y - 1 <= 100)
{
wj3y++;
}
}
if (runs >= 4)
{
if (GetKeyState(101) < 0 && (dt[dtbh][wj4x - 1][wj4y] == ' ' || dt[dtbh][wj4x - 1][wj4y] == '$') && wj4x > 1 && t4)
{
wj4x--;
for (long long i = 1; i <= 2; i++)
if (dt[dtbh][wj4x - 1][wj4y] == ' ' && wj4x > 1)wj4x--;
t4 = 0;
}
if (GetKeyState(97) < 0 && (dt[dtbh][wj4x][wj4y - 1] == ' ' || dt[dtbh][wj4x][wj4y - 1] == '$') && wj4y - 1 > 0)
{
wj4y--;
}
if (GetKeyState(99) < 0 && (dt[dtbh][wj4x][wj4y + 1] == ' ' || dt[dtbh][wj4x][wj4y + 1] == '$') && wj4y - 1 <= 100)
{
wj4y++;
}
}
return;
}
void lx()
{
if (dt[dtbh][wj1x + 1][wj1y] == ' ' || dt[dtbh][wj1x + 1][wj1y] == '$')wj1x++;
else t1 = 1;
if (dt[dtbh][wj2x + 1][wj2y] == ' ' || dt[dtbh][wj2x + 1][wj2y] == '$')wj2x++;
else t2 = 1;
if (dt[dtbh][wj3x + 1][wj3y] == ' ' || dt[dtbh][wj3x + 1][wj3y] == '$')wj3x++;
else t3 = 1;
if (dt[dtbh][wj4x + 1][wj4y] == ' ' || dt[dtbh][wj4x + 1][wj4y] == '$')wj4x++;
else t4 = 1;
return;
}
void bd()
{
if (dt[dtbh][wj1x][wj1y] == '$')
{
f = 0;
sy = 1;
}
if (dt[dtbh][wj2x][wj2y] == '$')
{
f = 0;
sy = 2;
}
if (dt[dtbh][wj3x][wj3y] == '$')
{
f = 0;
sy = 3;
}
if (dt[dtbh][wj4x][wj4y] == '$')
{
f = 0;
sy = 4;
}
if (wj1x == 20)
{
wj1x = csx[dtbh]; wj1y = csy[dtbh];
}
if (wj2x == 20)
{
wj2x = csx[dtbh]; wj2y = csy[dtbh];
}
if (wj3x == 20)
{
wj3x = csx[dtbh]; wj3y = csy[dtbh];
}
if (wj4x == 20)
{
wj4x = csx[dtbh]; wj4y = csy[dtbh];
}
if (dt[dtbh][wj1x + 1][wj1y] == '^')
{
wj1x = csx[dtbh]; wj1y = csy[dtbh];
}
if (dt[dtbh][wj2x + 1][wj2y] == '^')
{
wj2x = csx[dtbh]; wj2y = csy[dtbh];
}//
if (dt[dtbh][wj3x + 1][wj3y] == '^')
{
wj3x = csx[dtbh]; wj3y = csy[dtbh];
}
if (dt[dtbh][wj4x + 1][wj4y] == '^')
{
wj4x = csx[dtbh]; wj4y = csy[dtbh];
}//
if (dt[dtbh][wj1x][wj1y + 1] == '<')
{
wj1x = csx[dtbh]; wj1y = csy[dtbh];
}
if (dt[dtbh][wj2x][wj2y + 1] == '<')
{
wj2x = csx[dtbh]; wj2y = csy[dtbh];
}//
if (dt[dtbh][wj3x][wj3y + 1] == '<')
{
wj3x = csx[dtbh]; wj3y = csy[dtbh];
}
if (dt[dtbh][wj4x][wj4y + 1] == '<')
{
wj4x = csx[dtbh]; wj4y = csy[dtbh];
}//
if (dt[dtbh][wj1x][wj1y - 1] == '>')
{
wj1x = csx[dtbh]; wj1y = csy[dtbh];
}
if (dt[dtbh][wj2x][wj2y - 1] == '>')
{
wj2x = csx[dtbh]; wj2y = csy[dtbh];
}//
if (dt[dtbh][wj3x][wj3y - 1] == '>')
{
wj3x = csx[dtbh]; wj3y = csy[dtbh];
}
if (dt[dtbh][wj4x][wj4y - 1] == '>')
{
wj4x = csx[dtbh]; wj4y = csy[dtbh];
}//
if (dt[dtbh][wj1x + 1][wj1y] == '-')
{
for (long long i = 1; i <= 10 && wj1x > 1; i++)
{
if (dt[dtbh][wj1x - 1][wj1y] == ' ' || dt[dtbh][wj1x - 1][wj1y] == '$')
{
wj1x--;
}
else
break;
}
}
if (dt[dtbh][wj2x + 1][wj2y] == '-')
{
for (long long i = 1; i <= 10 && wj2x > 1; i++)
{
if (dt[dtbh][wj2x - 1][wj2y] == ' ' || dt[dtbh][wj2x - 1][wj2y] == '$')
{
wj2x--;
}
else
break;
}
}//
if (dt[dtbh][wj3x + 1][wj3y] == '-')
{
for (long long i = 1; i <= 10 && wj3x > 1; i++)
{
if (dt[dtbh][wj3x - 1][wj3y] == ' ' || dt[dtbh][wj3x - 1][wj3y] == '$')
{
wj3x--;
}
else
break;
}
}
if (dt[dtbh][wj4x + 1][wj4y] == '-')
{
for (long long i = 1; i <= 10 && wj4x > 1; i++)
{
if (dt[dtbh][wj4x - 1][wj4y] == ' ' || dt[dtbh][wj4x - 1][wj4y] == '$')
{
wj4x--;
}
else
break;
}
}
return;
}
void youxi()
{
system("cls");
char s;
while (1)
{
cout << "0.退出\n";
cout << "1.随机\n";
cout << "2.闯关\n";
s = _getch();
while (s != '0' && s != '1' && s != '2')s = _getch();
switch (s)
{
case '0':
system("cls");
return;
case '1':
suij();
break;
case '2':
cg();
break;
}
system("cls");
}
return;
}
void suij()
{
char s;
while (1)
{
csh();
dtbh = rand() % dts + 1;
wj1x = wj2x = wj3x = wj4x = csx[dtbh];
wj1y = wj2y = wj3y = wj4y = csy[dtbh];
system("cls");
out();
for (long long i = 1; f; i++)
{
gx();
color(240);
Sleep(50);
in();
bd();
if (cs == 1)
lx();
bd();
if (cs == 1)cs = -1;
cs++;
if (i == 1)
{
system("cls");
out();
}
}
system("cls");
if (runs >= 2)
{
if (sy == 0)
{
system("cls");
return;
}
if (sy == 1)
{
color(11);
system("cls");
cout << "*赢了!";
cout << "\n按Enter继续";
char t = _getch();
while (t != 13)t = _getch();
}
else
if (sy == 2)
{
color(12);
system("cls");
cout << "+赢了!";
cout << "\n按Enter继续";
char t = _getch();
while (t != 13)t = _getch();
}
else
if (sy == 3)
{
color(14);
system("cls");
cout << "!赢了!";
cout << "\n按Enter继续";
char t = _getch();
while (t != 13)t = _getch();
}
else
if (sy == 4)
{
color(10);
system("cls");
cout << "#赢了!";
cout << "\n按Enter继续";
char t = _getch();
while (t != 13)t = _getch();
}
}
else
{
if (sy == 0)
{
system("cls");
return;
}
else
{
color(11);
system("cls");
cout << "你赢了!!!";
cout << "\n按Enter继续";
char s = _getch();
while (s != 13)s = _getch();
}
}
color(240);
system("cls");
cout << "是否返回?(y/n)";
s = _getch();
while (s != 'y' && s != 'n')s = _getch();
if (s == 'y')
{
f = 0;
system("cls");
return;
}
system("cls");
}
return;
}
void gx()
{
if (dt[dts][y_1x][y_1y] != '$')
{
color(240);
ydgb(y_1x, y_1y + 1);
cout << '\b' << " ";
}
if (runs >= 2 && dt[dts][y_2x][y_2y] != '$')
{
ydgb(y_2x, y_2y + 1);
cout << '\b' << " ";
}
if (runs >= 3 && dt[dts][y_3x][y_3y] != '$')
{
ydgb(y_3x, y_3y + 1);
cout << '\b' << " ";
}
if (runs >= 4 && dt[dts][y_4x][y_4y] != '$')
{
ydgb(y_4x, y_4y + 1);
cout << '\b' << " ";
}
if (runs >= 4 && dt[dts][wj4x][wj4y] != '$')
{
color(10);
ydgb(wj4x, wj4y + 1);
if (dt[dts][y_4x][y_4y] != '$')
{
cout << '\b';
cout << "#";
}
}
if (runs >= 3 && dt[dts][wj3x][wj3y] != '$')
{
color(14);
ydgb(wj3x, wj3y + 1);
if (dt[dts][y_3x][y_3y] != '$')
{
cout << '\b';
cout << "!";
}
}
if (runs >= 2 && dt[dts][wj2x][wj2y] != '$')
{
color(12);
ydgb(wj2x, wj2y + 1);
if (dt[dts][y_2x][y_2y] != '$')
{
cout << '\b';
cout << "+";
}
}
if (dt[dts][wj1x][wj1y] != '$')
{
color(11);
ydgb(wj1x, wj1y + 1);
if (dt[dts][y_1x][y_1y] != '$')
{
cout << '\b';
cout << "*";
}
}
y_1x = wj1x, y_1y = wj1y;
if (runs >= 2)
{
y_2x = wj2x, y_2y = wj2y;
}
if (runs >= 3)
{
y_3x = wj3x, y_3y = wj3y;
}
if (runs >= 4)
{
y_4x = wj4x, y_4y = wj4y;
}
color(240);
return;
}
void cg()
{
csh();
char s;
system("cls");
while (f)
{
system("cls");
cout << "0.退出" << endl;
for (long long i = 1; i <= dts; i++)
{
if (cgjd > i)
{
cout << i << "." << dtm[i];
for (long long j = 1; j <= 20 - dtm[i].size(); j++)
{
cout << " ";
}
cout << "*";
}
else
if (cgjd == i)
{
cout << i << "." << dtm[i];
for (long long j = 1; j <= 20 - dtm[i].size(); j++)
{
cout << " ";
}
cout << "=";
}
else
{
cout << i << ".????" << " ";
cout << "+";
}
cout << endl;
}
s = _getch();
while (s < '0' || s>'0' + dts)s = _getch();
if (s == '0')
{
system("cls");
return;
}
if (s - '0' > cgjd)
{
system("cls");
cout << "你还没有解锁此关卡!\n";
cout << "按空格继续";
char t;
t = _getch();
while (t != ' ')t = _getch();
system("cls");
return;
}
system("cls");
dtbh = s - '0';
wj1x = wj2x = wj3x = wj4x = csx[dtbh];
wj1y = wj2y = wj3y = wj4y = csy[dtbh];
out();
for (long long i = 1; f; i++)
{
gx();
color(240);
Sleep(50);
in();
bd();
if (cs == 1)
lx();
bd();
if (cs == 1)cs = -1;
cs++;
if (i == 1)
{
system("cls");
out();
}
}
system("cls");
if (runs >= 2)
{
if (sy == 0)
{
system("cls");
return;
}
if (sy == 1)
{
color(11);
system("cls");
cout << "*赢了!";
cout << "\n按Enter继续";
char t = _getch();
while (t != 13)t = _getch();
}
else
if (sy == 2)
{
color(12);
system("cls");
cout << "+赢了!";
cout << "\n按Enter继续";
char t = _getch();
while (t != 13)t = _getch();
}
else
if (sy == 3)
{
color(14);
system("cls");
cout << "!赢了!";
cout << "\n按Enter继续";
char t = _getch();
while (t != 13)t = _getch();
}
else
if (sy == 4)
{
color(10);
system("cls");
cout << "#赢了!";
cout << "\n按Enter继续";
char t = _getch();
while (t != 13)t = _getch();
}
}
else
{
if (sy == 0)
{
system("cls");
return;
}
else
{
color(11);
system("cls");
cout << "你赢了!!!";
cout << "\n按Enter继续";
char s = _getch();
while (s != 13)s = _getch();
}
}
color(240);
if (cgjd == dtbh)
{
cgjd++;
}
system("cls");
}
return;
}
void smym()
{
char s;
system("cls");
cout << "游戏说明:\n";
cout << "0.退出\n";
cout << "1.操作说明\n";
cout << "2.物品说明\n";
cout << "3.游戏技巧\n";
s = _getch();
while (s != '0' && s != '1' && s != '2' && s != '3')s = _getch();
switch (s)
{
case '0':
system("cls");
return;
case '1':
szsmym();
break;
case '2':
wpsmym();
break;
case '3':
yxjqym();
break;
}
return;
}
void szsmym()
{
char s;
system("cls");
gs(0, 0, "操作说明:");
gs(1, 8, "-------"); gs(0, 6, "-------");
gs(1, 8, "|玩家1|"); gs(0, 6, "|玩家2|");
gs(1, 8, "| ^ |"); gs(0, 6, "| W |");
gs(1, 8, "|< >|"); gs(0, 6, "|A D|");
gs(1, 8, "|移动 |"); gs(0, 6, "|移动 |");
gs(1, 8, "-------"); gs(0, 6, "-------");
gs(1, 0, "");
gs(1, 8, "-------"); gs(0, 6, "-------");
gs(1, 8, "|玩家3|"); gs(0, 6, "|玩家4|");
gs(1, 8, "| I |"); gs(0, 6, "| 5 |");
gs(1, 8, "|J L|"); gs(0, 6, "|1 3|");
gs(1, 8, "|移动 |"); gs(0, 6, "|移动 |");
gs(1, 8, "-------"); gs(0, 6, "-------");
gs(1, 0, "");
gs(1, 4, "功能键:");
gs(1, 8, "P暂停");
cout << "\n\n按空格继续";
s = _getch();
while (s != ' ')s = _getch();
system("cls");
return;
}
void wpsmym()
{
char s;
system("cls");
cout << "* 玩家1\n";
cout << "+ 玩家2\n";
cout << "! 玩家3\n";
cout << "# 玩家3\n";
cout << "= 砖块\n";
cout << "$ 终点\n";
cout << "- 蹦床\n";
cout << "^ 上刺\n";
cout << "< 左刺\n";
cout << "> 右刺\n";
cout << "按空格继续";
s = _getch();
while (s != ' ')s = _getch();
system("cls");
return;
}
void yxjqym()
{
system("cls");
char s;
system("cls");
gs(1, 4, "游戏技巧:");
gs(1, 8, "1.延迟起跳:");
gs(1, 12, "如果上方有物品,跳起来会挡住");
gs(1, 12, "可以先走过去,等上方无遮挡物时按跳键");
gs(1, 12, "这样就可以跳的远了");
cout << "\n按空格继续";
s = _getch();
while (s != ' ')s = _getch();
system("cls");
return;
}
b_game.h
#ifndef b_game
#define b_game
#include<iostream>
#include<iomanip>
#include<string>
#include<cstdlib>
#include<ctime>
#include<windows.h>
#include<conio.h>
#include<fstream>
using namespace std;
namespace cd
{
struct cdhs//存档结构体
{
void out(int n, string name)//输出存档
{
ofstream cd(&name[0]);
cd << n;
return;
}
void out(long long n, string name)
{
ofstream cd(&name[0]);
cd << n;
return;
}
void out(bool n, string name)
{
ofstream cd(&name[0]);
cd << n;
return;
}
void out(char n, string name)
{
ofstream cd(&name[0]);
cd << n;
return;
}
void out(string n, string name)
{
ofstream cd(&name[0]);
cd << n;
return;
}//重载
void in(int& n, string name)//读入存档
{
ifstream cd(&name[0]);
cd >> n;
return;
}
void in(long long& n, string name)
{
ifstream cd(&name[0]);
cd >> n;
return;
}
void in(bool& n, string name)
{
ifstream cd(&name[0]);
cd >> n;
return;
}
void in(char& n, string name)
{
ifstream cd(&name[0]);
cd >> n;
return;
}
void in(string& n, string name)
{
ifstream cd(&name[0]);
cd >> n;
return;
}//重载
};
}
namespace sb_gb
{
struct hl//行列
{
long long h, l;
};
hl sbwz(bool x = 1, bool n = 1)//鼠标位置
{
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
HWND h = GetForegroundWindow();
CONSOLE_FONT_INFO consoleCurrentFont;
hl hl;
POINT p;
if (x)
{
GetCursorPos(&p);
ScreenToClient(h, &p);
}
else
{
GetCursorPos(&p);
}
if (n)
{
GetCurrentConsoleFont(hOutput, FALSE, &consoleCurrentFont);
p.x /= consoleCurrentFont.dwFontSize.X;
p.y /= consoleCurrentFont.dwFontSize.Y;
}
hl.h = p.y + 1;
hl.l = p.x + 1;
return hl;
}
void ycgb()//隐藏光标
{
CONSOLE_CURSOR_INFO cursor;
cursor.bVisible = FALSE;
cursor.dwSize = sizeof(cursor);
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorInfo(handle, &cursor);
return;
}
void ydgb(long long h, long long l)//移动光标
{
COORD pos = { l - 1,h - 1 };
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOut, pos);
return;
}
}
namespace shuchu
{
void bout(string n, long long s = 50, bool f = 0, char key = 13)//输出
{
for (long long i = 0; i < n.size(); i++)
{
if (f && GetKeyState(key) < 0)
{
cout << n.substr(i, n.size());
return;
}
cout << n[i];
Sleep(s);
}
return;
}
void gs(long long h, long long l, string z)//格式
{
for (long long i = 1; i <= h; i++)
cout << "\n";
for (long long i = 1; i <= l; i++)
cout << " ";
cout << z;
return;
}
}
namespace shuru
{
const long long ESC = 27,
Enter = 13,
Tab = 9,
Shang = 38,
Xia = 40,
Zuo = 37,
You = 39,
Kong = ' ',
z_sb = VK_LBUTTON,
y_sb = VK_RBUTTON,
Shift = VK_SHIFT,
z_Shift = VK_LSHIFT,
y_Shift = VK_RSHIFT,
Ctrl = VK_CONTROL,
z_Ctrl = VK_LCONTROL,
y_Ctrl = VK_RCONTROL,
Alt = VK_MENU,
z_Alt = VK_LMENU,
y_Alt = VK_RMENU,
A = 'A',
B = 'B',
C = 'C',
D = 'D',
E = 'E',
F = 'F',
G = 'G',
H = 'H',
I = 'I',
J = 'J',
K = 'K',
L = 'L',
M = 'M',
N = 'N',
O = 'O',
P = 'P',
Q = 'Q',
R = 'R',
S = 'S',
T = 'T',
U = 'U',
V = 'V',
W = 'W',
X = 'X',
Y = 'Y',
Z = 'Z';
bool axj(long long key)
{
return (GetKeyState(key) < 0);
}
}
namespace qt
{
void ckbb()//查看当前b_game.h库版本信息
{
system("cls");
cout << "库名:b_game.h\n";
cout << "类型:拓展库\n";
cout << "版本号:2.0\n";
return;
}
void ycbj()//移除快速编辑模式
{
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;
GetConsoleMode(hStdin, &mode);
mode &= ~ENABLE_QUICK_EDIT_MODE;
SetConsoleMode(hStdin, mode);
return;
}
}
namespace yanse
{
void color(int c)//颜色
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), c);
return;
}
}
#endif