DevC++躲避障碍小游戏

这里我制作了一个可以使用Dev-C++进行编译运行的小游戏。

目录

1. 游戏介绍

2. 游戏代码

3. 运行效果


游戏介绍

只是一款很简单的小游戏……

不过只有2.8mb左右,十分便携。(不是傻子都知道)

规则

游戏规则:
a) 用a与d左右移动 "i" 小人; 
b) 躲避 "#" 障碍; 
c) 获得 "$" 金钱, 一次100个金钱; 
d) 碰到障碍后, 可以使用金钱来复活; 
e) 中途可以按下空格键暂停. 

具体规则请见游戏。


游戏代码

不消说,直接上代码……

#include<iostream>
#include<Windows.h> 
#include<cstdlib>
#include<conio.h>
using namespace std;

#define textcolor(color) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),color)//宏定义字体颜色效果 
#define black 0
#define blue 1
#define green 2
#define lakeblue 3
#define red 4
#define purple 5
#define yellow 6
#define white 7
#define grey 8
#define lightblue 9
#define lightgreen 10
#define lightgreen_ 11
#define lightred 12
#define lightpurple 13
#define lightyellow 14

void home();//主页 
void game();//游戏 
void lose();//失败 
void ifmtn();//说明 

string mp[20]=
{
	"           ",
	" ###   # # ",
	" ###   #$# ",
	" ###   #$# ",
	" #### $  # ",
	" ###    ## ",
	" ##     ## ",
	" ##   # ## ",
	" #   ##$## ",
	" ##   #  # ",
	" ##      # ",
	" ## #  # # ",
	" ## #  #$# ",
	" ## $  # # ",
	" ##   #  # ",
	" #  # #$ # ",
	" #       # ",
	" #       # ",
	" #       # ",
	" #       # ",
};//地图(#障碍)
int x,y,money,stp,rgm,cntOFrg;//x和y坐标、金钱、步数、复活时花费的金额、复活次数 

void home(){
	textcolor(white);//设置字体为白色 
	
	money=stp=cntOFrg=0;//初始化金钱和步数 
	
	system("cls");//清屏 
	system("title 躲避障碍 - 主页");//设置标题 
	
	textcolor(lakeblue); 
	cout<<"▲▼▲▼▲▼★躲★避★障★碍
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值