概述
大家好,我是你们的编程小王子!今天为大家专门制作了一大系列的游戏
老样子点赞冲冲冲!
提前预告一下,等这个9月学期结束,差不多要给大家上图形库EGE了
先介绍一下,今天的主题是躺平发育(文字版的,原谅一下,目前还没有最终的图形库界面发布)
躺平发育规则有兴趣的小伙伴们可以上网去查询一下,我在这里就不细讲了
上代码吧
今天先来3个模式:正常模式、无限金币模式和盲盒模式
#include<bits/stdc++.h>
#include<windows.h>
#include<unistd.h>
using namespace std;
void rules();
int main(void) {
int c=1;
int m=1;
long long m_x=1000;
long long m_xl=1000;
int g_a=250;
int g_d=200;
int coins=50;
int p_n=1;
int n=0;
int win=100;
int buy;
int d_n=0;
int p_a=75;
int p_na, jj_a, jj_d;
system("cls");
cout<<"请选择难度:"<<endl;
cout<<endl;
cout<<endl;
cout<<"A.初级难度"<<endl;
cout<<endl;
cout<<"B.中级难度"<<endl;
cout<<endl;
cout<<"C.地狱难度"<<endl;
cout<<"请输入:";
char x;
cin>>x;
if(x=='A'){
jj_a=100;
jj_d=60;
p_na=50;
}
else if(x=='B'){
jj_a=125;
jj_d=75;
p_na=55;
}
else if(x=='C'){
jj_a=175;
jj_d=125;
p_na=45;
}
while(win>=0) {
if(n<0){
n=0;
}
if(win<=0){
break;
}
m_xl-=n*g_a;
if(m_xl<=0) {
system("cls");
cout<<"您的门已经被噬梦者攻破,G A M E O V E R!"<<endl;
return 0;
}
system("cls");
cout<<"金币:"<<coins<<" 电力:"<<d_n<<" 炮台:"<<p_n<<"个 "<<"门的血量:"<<m_xl<<endl;
cout<<endl;
cout<<" 墙墙墙墙 墙墙墙墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙 墙 墙 墙"<<endl;
cout<<" 墙 墙 怪 墙 墙"<<endl;
cout<<" 墙 墙 "<<n<<" 墙 墙"<<endl;
cout<<"墙墙墙墙 墙 门 墙 墙墙墙墙"<<endl;
cout<<"墙 ◎ ◎ ◎ 墙"<<endl;
cout<<"墙 ◎ 床 ◎ ☆☆☆墙"<<endl;
cout<<"墙 ☆★★墙"<<endl;
cout<<"墙 ☆★★墙"<<endl;
cout<<"墙墙墙墙墙墙墙墙墙墙墙墙墙墙墙墙"<<endl;
cout<<endl;
cout<<"您正在床上发育……"<<endl;
cout<<"有"<<n<<"只噬梦者在挠你的门!"<<endl;
cout<<"输入1以建造炮台:25金币"<<endl;
cout<<"输入2以升级门: 50金币"<<endl;
cout<<"输入3以升级床: 35金币"<<endl;
cout<<"输入4以放弃此次建造机会"<<endl;
cout<<"输入5以拆除1个炮台:获得15金币"<<endl;
cout<<"输入6以让门回血"<<endl;
cout<<"您的门的级位是"<<m<<"级"<<endl;
cout<<"您的床是"<<c<<"级"<<endl;
cout<<"◎:炮台"<<endl;
cout<<"☆:维修台"<<endl;
cout<<"★:发电机"<<endl;
n-=p_n*p_a/g_d;
win-=p_n*p_a/g_d;
cin>>buy;
switch(buy) {
case 1:
if(coins<25) {
cout<<"您的钱不够"<<endl;
break;
}
if(p_n==17){
cout<<"最大上限为17个炮台!"<<endl;
break;
}
coins-=25;
p_n++;
break;
case 2:
if(coins<50) {
cout<<"您的钱不够"<<endl;
break;
}
if(m==19){
cout<<"您的门已达到黄金门,不能够再次升级了!"<<endl;
system("pause");
break;
}
coins-=50;
m++;
m_x*=7;
m_xl=m_x;
break;
case 3:
if(coins<35) {
cout<<"您的钱不够"<<endl;
break;
}
coins-=35;
c++;
break;
case 4:
break;
case 5:
coins+=15;
p_n--;
case 6:
m_xl=m_x;
break;
default:
cout<<"没有此选项"<<endl;
break;
}
if(m_xl==0) {
system("cls");
cout<<"您的门已经被噬梦者攻破,G A M E O V E R!"<<endl;
return 0;
}
if(n==31) {
n--;
}
coins+=c*15;
sleep(2);
n++;
if(n==31) {
n--;
}
d_n+=4*10000;
}
cout<<"恭喜您打败了所有噬梦者,获得了胜利!"<<endl;
}
void rules() {
string o="您在野外建造了一间房屋,现在是晚上,有噬梦者来攻击您。如果您能打败所有(100个)噬梦者,您就胜利了!如果门被挠破,则输!";
for(int i=0; i<o.size(); i++) {
cout<<o[i];
Sleep(100);
}
cout<<endl;
cout<<endl;
system("pause");
}
上面是正常模式
#include<bits/stdc++.h>
#include<windows.h>
#include<unistd.h>
using namespace std;
void rules();
int main(void) {
int c=1;
int m=1;
long long m_x=1000;
long long m_xl=1000;
int g_a=250;
int g_d=200;
int coins=100;
int p_n=1;
int n=0;
int win=100;
int buy;
int d_n=0;
int p_a=75;
int cnt=0;
int m_n=1;
int ji=n*g_a;
// rules();
int p_na, jj_a, jj_d;
system("cls");
cout<<"请选择难度:"<<endl;
cout<<endl;
cout<<endl;
cout<<"A.初级难度"<<endl;
cout<<endl;
cout<<"B.中级难度"<<endl;
cout<<endl;
cout<<"C.地狱难度"<<endl;
cout<<"请输入:";
char x;
cin>>x;
if(x=='A'){
jj_a=100;
jj_d=60;
p_na=50;
}
else if(x=='B'){
jj_a=125;
jj_d=75;
p_na=55;
}
else if(x=='C'){
jj_a=175;
jj_d=125;
p_na=45;
}
while(win>=0) {
m_xl-=n*g_a;
if(n<0){
n=0;
}
if(win<=0){
break;
}
if(m_n<=0){
cout<<"您被噬梦者打败了!"<<endl;
return 0;
}
if(m_xl<=0) {
system("cls");
cout<<"您的门已经被噬梦者攻破,G A M E O V E R!"<<endl;
return 0;
}
system("cls");
cout<<"金币:"<<coins<<" 电力:"<<d_n<<" 炮台:"<<p_n<<"个 "<<"门的血量:"<<m_xl<<endl;
cout<<endl;
cout<<" 墙墙墙墙 墙墙墙墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙 墙 怪 墙 墙"<<endl;
cout<<" 墙 ◎墙 "<<n<<" 墙 墙"<<endl;
cout<<"墙墙墙墙 墙 门 墙 墙墙墙墙"<<endl;
cout<<"墙 墙"<<endl;
cout<<"墙 床 ☆☆☆墙"<<endl;
cout<<"墙 ☆★★墙"<<endl;
cout<<"墙 ☆★★墙"<<endl;
cout<<"墙墙墙墙墙墙墙墙墙墙墙墙墙墙墙墙"<<endl;
cout<<endl;
cout<<"您正在床上发育……"<<endl;
cout<<"有"<<n<<"个噬梦者在挠你的门!"<<endl;
cout<<"您还需要击败"<<win<<"个噬梦者"<<endl;
cout<<"目前的噬梦者攻击力为:"<<g_a<<" 防御力为:"<<g_d<<endl;
cout<<"您的炮台攻击力为:"<<p_a<<endl;
cout<<"输入1以建造炮台:25金币"<<endl;
cout<<"输入2以升级门: 50金币"<<endl;
cout<<"输入3以升级床: 35金币"<<endl;
cout<<"输入4以放弃此次建造机会"<<endl;
cout<<"输入5以拆除1个炮台:获得15金币"<<endl;
cout<<"输入6以让门回血(免费)"<<endl;
cout<<"您的门的级位是"<<m<<"级"<<endl;
cout<<"您的床是"<<c<<"级"<<endl;
cout<<"◎:炮台"<<endl;
cout<<"☆:维修台"<<endl;
cout<<"★:发电机"<<endl;
n-=p_n*p_a/g_d;
win-=p_n*p_a/g_d;
cin>>buy;
switch(buy) {
case 1:
if(p_n==17){
cout<<"最大上限为17个炮台!"<<endl;
break;
}
coins+=25;
p_n++;
break;
case 2:
if(m==19){
cout<<"您的门已达到黄金门,不能够再次升级了!"<<endl;
system("pause");
break;
}
coins+=50;
m++;
m_x*=5;
m_xl=m_x;
break;
case 3:
coins+=35;
c++;
break;
case 4:
break;
case 5:
coins+=15;
p_n--;
case 6:
m_xl=m_x;
break;
default:
cout<<"没有此选项"<<endl;
break;
}
if(m_xl==0) {
system("cls");
cout<<"您的门已经被噬梦者攻破,梦境惊醒!"<<endl;
cout<<" G A M E O V E R! "<<endl;
return 0;
}
if(n==31) {
n--;
}
coins+=c*15;
sleep(2);
n++;
if(n==31) {
n--;
}
d_n+=4*10000;
}
cout<<"恭喜您打败了所有噬梦者,获得了胜利!"<<endl;
}
void rules() {
string o="您在野外建造了一间房屋,现在是晚上,有噬梦者来攻击您。如果您能打败所有(100个)噬梦者,您就胜利了!如果门被挠破,则输!";
for(int i=0; i<o.size(); i++) {
cout<<o[i];
Sleep(100);
}
cout<<endl;
cout<<endl;
system("pause");
}
这个是无限金币模式(金币越用越多)
#include<bits/stdc++.h>
#include<windows.h>
#include<unistd.h>
using namespace std;
int count_down=0;
int c=1;
int m=1;
long long m_x=1000;
long long m_xl=1000;
int g_a=250;
int g_d=200;
int coins=50;
int p_n=1;
int n=0;
int win=100;
int buy;
int d_n=0;
int p_a=75;
int p_na, jj_a, jj_d;
int wx_n=0, wx=35;
int dl=0;
int zcm_n=0;
void mh_smjn();
int main(void) {
system("cls");
cout<<"请选择难度:"<<endl;
cout<<endl;
cout<<endl;
cout<<"A.初级难度"<<endl;
cout<<endl;
cout<<"B.中级难度"<<endl;
cout<<endl;
cout<<"C.地狱难度"<<endl;
cout<<"请输入:";
char x;
cin>>x;
if(x=='A') {
jj_a=100;
jj_d=60;
p_na=50;
} else if(x=='B') {
jj_a=125;
jj_d=75;
p_na=55;
} else if(x=='C') {
jj_a=175;
jj_d=125;
p_na=45;
}
while(win>=0) {
if(n<0) {
n=0;
}
if(win<=0) {
break;
}
m_xl-=n*g_a;
if(m_xl<=0) {
system("cls");
cout<<"您的门已经被噬梦者攻破,G A M E O V E R!"<<endl;
return 0;
}
system("cls");
cout<<"金币:"<<coins<<" 电力:"<<d_n<<" 炮台:"<<p_n<<"个 "<<"门的血量:"<<m_xl<<endl;
cout<<endl;
cout<<" 墙墙墙墙 墙墙墙墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙 墙 墙 墙"<<endl;
cout<<" 墙 墙 怪 墙 墙"<<endl;
cout<<" 墙 墙 "<<n<<" 墙 墙"<<endl;
cout<<"墙墙墙墙 墙 门 墙 墙墙墙墙"<<endl;
cout<<"墙 ◎ ◎ ◎ 墙"<<endl;
cout<<"墙 ◎ 床 ◎ ☆☆☆墙"<<endl;
cout<<"墙 ☆★★墙"<<endl;
cout<<"墙 ☆★★墙"<<endl;
cout<<"墙墙墙墙墙墙墙墙墙墙墙墙墙墙墙墙"<<endl;
cout<<endl;
cout<<"您正在床上发育……"<<endl;
cout<<"有"<<n<<"只噬梦者在挠你的门!"<<endl;
cout<<"输入1以建造炮台:25金币,300电量"<<endl;
cout<<"输入2以升级门: 50金币"<<endl;
cout<<"输入3以升级床: 35金币"<<endl;
cout<<"输入4以建造招财猫:40金币,200电量"<<endl;
cout<<"输入5以建造游戏机(产生电量):45金币"<<endl;
cout<<"输入6以建造修理台(维护大门的血量):20金币,50电量"<<endl;
cout<<"输入7以放弃此次建造机会"<<endl;
cout<<"输入8以拆除1个炮台:获得15金币"<<endl;
cout<<"输入9以让门回血"<<endl;
cout<<"输入0以使用盲盒技能"<<endl;
cout<<"您的门的级位是"<<m<<"级"<<endl;
cout<<"您的床是"<<c<<"级"<<endl;
cout<<"您有"<<zcm_n<<"个招财猫"<<endl;
cout<<"您有"<<dl<<"个游戏机"<<endl;
cout<<"您有"<<wx_n<<"个修理台"<<endl;
cout<<"您使用了"<<count_down<<"次神秘盲盒技能"<<endl;
cout<<"◎:炮台"<<endl;
cout<<"☆:维修台"<<endl;
cout<<"★:发电机"<<endl;
n-=p_n*p_a/g_d;
win-=p_n*p_a/g_d;
cin>>buy;
switch(buy) {
case 1:
if(coins<25 && d_n<300) {
cout<<"您的钱和电量都不够"<<endl;
} else if(coins<25) {
cout<<"您的钱不够"<<endl;
break;
} else if(d_n<300) {
cout<<"您的电量不够"<<endl;
}
if(p_n==17) {
cout<<"最大上限为17个炮台!"<<endl;
break;
}
coins-=25;
p_n++;
break;
case 2:
if(coins<50) {
cout<<"您的钱不够"<<endl;
break;
}
if(m==19) {
cout<<"您的门已达到黄金门,不能够再次升级了!"<<endl;
system("pause");
break;
}
coins-=50;
m++;
m_x*=7;
m_xl=m_x;
break;
case 3:
if(coins<35) {
cout<<"您的钱不够"<<endl;
break;
}
coins-=35;
c++;
break;
case 4:
if(coins<40 && d_n<200) {
cout<<"您的钱和电量不够"<<endl;
break;
} else if(coins<40) {
cout<<"您的钱不够"<<endl;
break;
} else if(d_n<200) {
cout<<"您的电量不够"<<endl;
break;
}
coins-=40;
d_n-=200;
zcm_n++;
break;
case 5:
if(coins<45) {
cout<<"您的钱不够"<<endl;
break;
}
coins-=45;
dl++;
break;
case 6:
if(coins<20 && d_n<50) {
cout<<"您的钱和电量不够"<<endl;
break;
} else if(coins<20) {
cout<<"您的钱不够"<<endl;
break;
} else if(d_n<50) {
cout<<"您的电量不够"<<endl;
break;
}
wx_n++;
coins-=20;
d_n-=50;
break;
case 7:
break;
case 8:
coins+=15;
p_n--;
case 9:
m_xl=m_x;
break;
case 0:
if(count_down==6) {
cout<<"您的神秘盲盒技能已经用完,无法再次使用"<<endl;
break;
}
mh_smjn();
count_down++;
break;
default:
cout<<"没有此选项"<<endl;
break;
}
if(m_xl==0) {
system("cls");
cout<<"您的门已经被噬梦者攻破,G A M E O V E R!"<<endl;
return 0;
}
if(n==31) {
n--;
}
coins+=c*15;
sleep(2);
n++;
if(n==31) {
n--;
}
d_n+=dl*100;
coins+=zcm_n*20;
if(wx_n>=1) {
m_xl+=wx_n*wx;
}
}
cout<<"恭喜您打败了所有噬梦者,获得了胜利!"<<endl;
}
void mh_smjn() {
int mh;
for(int i=1; i<=5; i++) {
srand(time(0));
mh=rand()%6+1;
}
switch(mh) {
case 1:
system("cls");
cout<<"门升级了"<<endl;
system("pause");
system("cls");
m++;
break;
case 2:
system("cls");
cout<<"床升级了"<<endl;
system("pause");
system("cls");
c++;
break;
case 3:
system("cls");
cout<<"新建造了一个炮台"<<endl;
system("pause");
system("cls");
p_n++;
break;
case 4:
system("cls");
cout<<"新建了一个招财猫"<<endl;
system("pause");
system("cls");
zcm_n++;
break;
case 5:
system("cls");
cout<<"新建了一个游戏机"<<endl;
system("pause");
system("cls");
dl++;
break;
case 6:
system("cls");
cout<<"新建了一个修理台"<<endl;
system("pause");
system("cls");
wx_n++;
break;
}
}
最后这个是盲盒模式(道具偏多)
好了。今天就先给大家这些。
如果有什么特别想看想玩的,可以关注我,然后私信。如果在我的能力范围内的话,我会努力为大家制作的
拜拜ヾ( ̄▽ ̄)Bye~Bye~
最后
以上就是义气高山为你收集整理的Dev-C++5.11游戏创作之躺平发育的全部内容,希望文章能够帮你解决Dev-C++5.11游戏创作之躺平发育所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复