我的商店小游戏

博主带来了一款商店小游戏的设计思路和实现过程,通过图文并茂的方式展示游戏的关键部分,并提供了部分代码供读者参考。
摘要由CSDN通过智能技术生成

hi,又和大家见面了
别来无恙,这次有为大家准备了一个小游戏给大家借鉴
再看看几张图在这里插入图片描述
放代码

#include <bits/stdc++.h>
#include <windows.h>
#include <cstdio>
using namespace std;
int money=1000,yh=0,fangchan=0,jl=0,kl=0,sys=0,jidan=0,cyd=0,zl=1,ml=1,qd;
int hxdzh=0,xyqz=0,hjdxn=0,yu=0,xia=0,yan=0,huajiao=0,xiannai=0,qiezi=0,worker=2,xyqzxp=0,jls=0,housedj=0;
int main()
{
unsigned int a,name;
cout<<"1.0.1正式版"<<endl;
Sleep(2000);
cout<<"注意:请勿输入英文"<<endl;
Sleep(1000);
cout<<"请输入你的名字(只支持数字)"<<endl;
cin>>name;
cout<<"你的名字是"<<name<<endl;
goto a1;
a1:cout<<"现在你要去哪里?"<<endl;
cout<<"====================================================================="<<endl;
cout<<"1.店铺 2.查看属性 3.市场 4.银行 5.加工坊 6.查看产品配方 7.解锁咸鱼茄子 "<<endl;
cout<<"8.雇佣工人 9.仓库 10.吉祥物 11.家园(维护中) 12.股票 13.房产 14.宠物 "<<endl;
cout<<"15.每日签到"<<endl;
cout<<"====================================================================="<<endl;
cin>>a;
if(a==1)
{
unsigned int i;
cout<<"请输入要出售的商品"<<"1.海鲜大杂烩 2.咸鱼茄子 3.茶叶蛋"<<endl;
cin>>i;
if(i==1)
{
cout<<"请输入出售的数量"<<endl;
unsigned int o;
cin>>o;
if(hxdzh>=o)
{
cout<<"已出售"<<o<<"碗海鲜大杂烩,获得"<<o*15+jls*o+jl*o<<"元"<<endl;
hxdzh-=o;
money+=o*15+jls*o+jl*o;
Sleep(1000);
goto a1;
}
else
cout<<"海鲜大杂烩不足"<<endl;
Sleep(1000);
goto a1;
}
if(i==2)
{
cout<<"请输入出售的数量"<<endl;
unsigned int u;
cin>>u;
if(xyqz>=u)
{
cout<<"已出售"<<u<<"碗咸鱼茄子,获得"<<u*17+jls*u+jl*u<<"元"<<endl;
xyqz-=u;
money+=u*17+jls*u+jl*u;
Sleep(1000);
goto a1;
}
else
cout<<"咸鱼茄子不够!"<<endl;
goto a1;
}
if(i==3)
{
cout<<"请输入出售的数量"<<endl;
unsigned int a6;
cin>>a6;
if(cyd>=a6)
{
cout<<"已出售"<<a6<<"个茶叶蛋,获得"<<a6*2+jls*a6+jl*a6<<"元"<<endl;
hxdzh-=a6;
money+=a6*15+jls*a6+jl*a6;
Sleep(1000);
goto a1;
}
else
cout<<"茶叶蛋不足"<<endl;
Sleep(1000);
goto a1;
}
}
if(a==2)
{
unsigned int b;
cout<<"1.查看属性 2.查看钱包"<<endl;
cin>>b;
if(b==1)
{
cout<<"名称:" <<name<<endl;
cout<<"智力:zl"<<endl;
cout<<"魅力:ml"<<endl;
Sleep(1200);
goto a1;
}
if(b==2)
{
cout<<"现金:"<<money<<endl;
cout<<"银行账户:"<<yh<<endl;
Sleep(1200);
goto a1;
}
else
goto a1;
}
if(a==3)
{
cout<<"你要买什么?"<<endl;
Sleep(1000);
cout<<"1.鱼(6元) 2.虾(5元) 3.盐(3元) 4.茄子(4元) 5.鸡蛋(1元)"<<endl;
unsigned int j;
cin>>j;
if(j==1)
{
cout<<"你要买多少?"<<endl;
unsigned int k;
cin>>k;
if(money>=k*6)
{
cout<<"购买成功,花费"<<k*6<<"元"<<endl;
money-=k*6;
yu+=k;
Sleep(1500);
goto a1;
}
else
cout<<"金额不足"<<endl;
goto a1;
}
if(j==2)
{
cout<<"你要买多少?"<<endl;
unsigned int l;
cin>>l;
if(money>=l*5)
{
cout<<"购买成功,花费"<<l*5<<"元"<<endl;
money-=l*5;
xia+=l;
Sleep(1500);
goto a1;
}
}
if(j==3)
{
cout<<"你要买多少?"<<endl;
unsigned int q;
cin>>q;
if(money>=q*3)
{
cout<<"购买成功,花费"<<q*3<<"元"<<endl;
money-=q*3;
yan+=q;
Sleep(1500);
goto a1;
}
}
if(j==4)
{
cout<<"你要买多少?"<<endl;
unsigned int r;
cin>>r;
if(money>=r*4)
{
cout<<"购买成功,花费"<<r*4<<"元"<<endl;
money-=r*4;
qiezi+=r;
Sleep(1500);
goto a1;
}
else
goto a1;
}
if(j==5)
{
cout<<"你要买多少?"<<endl;
unsigned int a5;
cin>>a5;
if(money>=a5*5)
{
cout<<"购买成功,花费"<<a5*5<<"元"<<endl;
money-=a5*5;
jidan+=a5;
Sleep(1500);
goto a1;
}
else
goto a1;
}
else
goto a1;
}
if(a==4)
{
unsigned int f,g,h;
cout<<"1.存钱 2.取钱"<<endl;
cin>>f;
if(f==1)
{
cout<<"请输入金额"<<endl;
cin>>g;
if(money>=g)
{
cout<<"存钱成功"<<endl;
money-=g;
yh+=g;
goto a1;
}
else
cout<<"错误"<<endl;
goto a1;
}
if(f==2)
{
cout<<"请输入金额"<<endl;
cin>>h;
if(yh>=h)
{
cout<<"取钱成功"<<endl;
yh-=h;
money+=h;
goto a1;
}
else
cout<<"错误"<<endl;
goto a1;
}

}
if(a==5)
{
cout<<"请输入要加工的产品,你有"<<worker<<"个工人,最多同时加工"<<worker*10<<"件产品"<<endl;
Sleep(1000);
cout<<"1.海鲜大杂烩 2.咸鱼茄子" <<endl;
unsigned int m;
cin>>m;
if(m==1)
{
cout<<"请输入加工的数量"<<endl;
unsigned int n;
cin>>n;
if(n<=worker*10)
{
if(yu>=n)
{
if(xia>=n)
{
cout<<"制作中."<<endl;
Sleep(1200-kl*600);
cout<<"制作中.."<<endl;
Sleep(1200-kl*600);
cout<<"制作中..."<<endl;
Sleep(1200-kl*600);
cout<<"制作成功"<<endl;
yu-=n;
xia-=n;
hxdzh+=n;
Sleep(1500);
goto a1;
}
else
cout<<"虾不足"<<endl;
goto a1;
}
else
cout<<"鱼不足"<<endl;
goto a1;
}
else
cout<<"工人不足"<<endl;
}
if(m==2)
{
cout<<"请输入加工的数量"<<endl;
unsigned int s;
cin>>s;
if(xyqzxp>=1)
{
if(s<=worker*10)
{
if(yu>=s)
{
if(qiezi>=s)
{
if(yan>=s)
{
cout<<"制作中."<<endl;
Sleep(1200);
cout<<"制作中.."<<endl;
Sleep(1200);
cout<<"制作中..."<<endl;
Sleep(1200);
cout<<"制作成功"<<endl;
yu-=s;
qiezi-=s;
yan-=s;
xyqz+=s;
Sleep(1500);
goto a1;
}
else
goto a1;
}
else
goto a1;
}
else
cout<<"材料不足"<<endl;
Sleep(750);
goto a1;
}
else
cout<<"工人不足"<<endl;
goto a1;
}
else
cout<<"未解锁"<<endl;
}
}
if(a==6)
{
cout<<"你要查看哪个配方?"<<endl;
Sleep(700);
cout<<"1.海鲜大杂烩 2.咸鱼茄子"<<endl;
unsigned int p;
cin>>p;
if(p==1)
{
cout<<"海鲜大杂烩:鱼*1,虾*1;出售价格15元"<<endl;
Sleep(750);
goto a1;
}
if(p==2)
{
cout<<"咸鱼茄子:盐*1 鱼*1 茄子*1;出售价格17元"<<endl;
Sleep(750);
goto a1;
}
}
if(a==7)
{
cout<<"确定花费50元解锁咸鱼茄子吗1.确定 2.算了"<<endl;
unsigned int t;
cin>>t;
if(t==1)
{
cout<<"解锁成功!"<<endl;
money-=50;
xyqzxp+=1;
Sleep(1000);
goto a1;
}
else
goto a1;
}
if(a==8)
{
cout<<"请输入要购买工人的人数(100元一名)"<<endl;
unsigned int w;
cin>>w;
if(money>=w*100)
{
cout<<"购买成功!"<<endl;
worker+=w;
money-=w*100;
goto a1;
}
}
if(a==9)
{
cout<<"咸鱼茄子"<<xyqz<<"个"<<endl;
cout<<"海鲜大杂烩"<<hxdzh<<"个"<<endl;
cout<<"茶叶蛋"<<cyd<<"个"<<endl;
cout<<"鱼"<<yu<<"个"<<endl;
cout<<"盐"<<yan<<"个"<<endl;
cout<<"虾"<<xia<<"个"<<endl;
cout<<"茄子"<<qiezi<<"个"<<endl;
cout<<"鸡蛋"<<jidan<<"个"<<endl;
Sleep(550);
goto a1;
}
if(a==10)
{
cout<<"你想要哪个吉祥物?1.金杯"<<endl;
unsigned int x;
cin>>x;
if(x==1)
{
cout<<"是否花费150金币购买金杯吉祥物? 1.是 2.否" <<endl;
unsigned int y;
cin>>y;
if(y==1)
{
if(money>=150)
{
if(jls==1)
{
cout<<"你已有金杯吉祥物"<<endl;
goto a1;
}
else
cout<<"购买成功,之后出售价格升高1元"<<endl;
money-=150;
jls+=1;
goto a1;
}
else
cout<<"金额不够"<<endl;
}
else
goto a1;
}
}
if(a==11)
{
cout<<"家园介绍:能存放宠物,级别越高,存放宠物数量上限越高。"<<endl;
Sleep(650);
cout<<"你要去哪里? 1.升级家园"<<endl;
unsigned int z;
cin>>z;
if(z==1)
{
cout<<"是否花费100元升级家园至"<<housedj+1<<"? 1.是 2.否"<<endl;
unsigned int a1;
cin>>a1;
if(a1==1)
{
if(housedj==2)
{
cout<<"已达到最高等级"<<endl;
goto a1;
}
else
if(money>=150)
{
cout<<"升级完成"<<endl;
money-=150;
housedj+=1;
goto a1;
}
else
goto a1;
}
else
goto a1;
}
}
if(a==12)
{
cout<<"你要用多少元买股票?"<<endl;
unsigned int a2;
cin>>a2;
if(a2>yh)
{
cout<<"银行账户余额不足"<<endl;
goto a1;
}
else
yh-=a2;
printf("购买成功,等待中……\n");
Sleep(800);
int cunqian;
cunqian=rand()%10;
if(cunqian<=2)
{
cout<<"得到1.5倍的钱"<<endl;
a2*=1.5;
yh+=a2;
goto a1;
}
if(cunqian>2&&cunqian<=7)
{
cout<<"得到1.2倍的钱"<<endl;
a2*=1.2;
yh+=a2;
goto a1;
}
if(cunqian>7)
cout<<"只得到0.6倍的钱"<<endl;
{
a2*=0.6;
yh+=a2;
goto a1;
}
}
if(a==13)
{
cout<<"暂未开放"<<endl;
goto a1;
}
if(a==14)
{
cout<<"你要什么宠物?1.空灵(200元) 2.金灵(200元)"<<endl;
unsigned int a4;
cin>>a4;
if(a4==1)
{
if(money>=200)
{
if(kl<1)
{
cout<<"购买成功"<<endl;
kl+=1;
money-=200;
}
else
cout<<"你已经有空灵"<<endl;
goto a1;
}
else
cout<<"金钱不足"<<endl;
goto a1;
}
if(a4==2)
{
if(money>=200)
{
if(jl<1)
{
cout<<"购买成功"<<endl;
jl+=1;
money-=200;
}
else
cout<<"你已经有金灵"<<endl;
goto a1;
}
else
cout<<"金钱不足"<<endl;
goto a1;
}
else
goto a1;
}
if(a==15)
{
if(qd==1)
{
cout<<"你已签到"<<endl;
goto a1;
}
money+=100;
qd+=1;
goto a1;
}
else
goto a1;
return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值