Hello!大家好,我是@学霸小羊,今天分享一个Goc游戏。
//注:以下代码为Goc原创代码。
大家可以在下面网址写入代码www.51goc.com慧通教育http://www.51goc.com注:Goc编辑器路径:
www.51goc.com ➡ 登录 ➡ 游客登陆 ➡ 入门课程 ➡ WebGoc
实在不行就试一下 下面这个链接:
WebGochttps://www.51goc.com/static/gocWebNet/gocWebNet.html?submitBt=0&insert=0&ra=60&winName=20200413
给点面子,评论一下这个作品吧!
int main(){p.rr(1000,1000,14).hide();//pen.button(id,string,col,size, dir,x,y,bgcol,edgecol);p.moveTo(0,100);p.button(0,"开始游戏",5,50,0,0,-200,1,5);pen.text("作者:小羊",5,50,0,0,-40,1);while(1){int f=0;if(buttonMP(0)){break;}for(int i=25;i<=150;i++){p.rr(800,200,14).text("赚钱模拟器",5,i);wait(0.003);if(buttonMP(0)){break;f=1;}if(i>80)wait(0.001);if(buttonMP(0)){break;f=1;}}if(f==1){break;}for(int i=150;i>=25;i--){p.rr(800,200,14).text("赚钱模拟器",5,i);wait(0.003);if(buttonMP(0)){break;f=1;}}if(f==1){break;}}int money=0,rishouru=0,baoshidu=50,tianshu=1;p.rr(1000,1000,14);pen.text("第",13,50,0,325,30,14);pen.text(tianshu,13,50,0,325,-30,14);pen.text("天",13,50,0,325,-90,14);pen.text("日收入:",13,50,0,-275,-185,14);pen.text("总资产:",13,50,0,-275,-130,14);pen.text("饱食度:",13,50,0,0,-250,14);pen.text(rishouru,13,50,0,-120,-185,14);pen.text(money,13,50,0,-120,-130,14);pen.text(baoshidu,13,50,0,0,-325,14);p.button(1,"乞讨",5,100,0,-250,-300,1,5);p.button(2,"买彩票",5,75,0,250,-250,1,5);pen.text("成本100元,收入0—500元",13,20,0,250,-350,14);p.button(3,"卖矿泉水",5,50,0,-250,300,1,5);pen.text("成本20元,日收入+2元",13,20,0,-250,220,14);p.button(4,"卖烟",5,50,0,0,300,1,5);pen.text("成本50元,日收入+5元",13,20,0,0,220,14);p.button(5,"卖酒",5,50,0,250,300,1,5);pen.text("成本200元,日收入+25元",13,20,0,250,220,14);p.button(6,"卖饮料",5,50,0,-250,160,1,5);pen.text("成本100元,日收入+15元",13,20,0,-250,80,14);p.button(7,"做屠夫卖肉",5,50,0,50,160,1,5);pen.text("成本500元,日收入+50元",13,20,0,50,80,14);p.button(8,"买食物",5,40,0,300,160,1,5);pen.text("成本50元,饱食度+20",13,20,0,300,80,14);p.button(9,"进城",5,150,0,75,-50,1,5);pen.text("花费100000元",13,50,0,75,-175,14);p.speed(10).moveTo(-250,-20).r(300,160).hide();for(int i=1;;i++){if(buttonMP(1)){int x=rand(0,rand(20,50));money+=x;pen.text(money,13,50,0,-120,-130,14);pen.text("乞讨到",13,40,0,-320,-20,14);pen.text(x,13,50,0,-225,-20,14);pen.text("元",13,40,0,-150,-20,14);wait(0.5);p.moveTo(-250,-20).rr(290,150,14);}if(buttonMP(2)){if(money>=100){money-=100;pen.text(money,13,50,0,-120,-130,14);int t=rand(0,50)*10;money+=t;pen.text(money,13,50,0,-120,-130,14);if(t!=0){pen.text("中奖了!中了:",13,40,0,-250,10,14);pen.text(t,13,50,0,-250,-40,14);pen.text("元",13,30,0,-150,-40,14);}else{pen.text("没中奖。",13,50,0,-250,-20,14); }wait(1);p.moveTo(-250,-20).rr(290,150,14);}else{pen.text("钱不够!",13,50,0,-250,-20,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}}if(buttonMP(3)){if(money>=20){money-=20;rishouru+=2;pen.text(money,13,50,0,-120,-130,14);pen.text(rishouru,13,50,0,-120,-185,14);pen.text("日收入+2元",13,40,0,-250,-20,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}else{pen.text("钱不够!",13,50,0,-250,-20,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}}if(buttonMP(4)){if(money>=50){money-=50;rishouru+=5;pen.text(money,13,50,0,-120,-130,14);pen.text(rishouru,13,50,0,-120,-185,14);pen.text("日收入+5元",13,40,0,-250,-20,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}else{pen.text("钱不够!",13,50,0,-250,-20,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}}if(buttonMP(5)){if(money>=200){money-=200;rishouru+=25;pen.text(money,13,50,0,-120,-130,14);pen.text(rishouru,13,50,0,-120,-185,14);pen.text("日收入+25元",13,40,0,-250,-20,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}else{pen.text("钱不够!",13,50,0,-250,-20,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}}if(buttonMP(6)){if(money>=100){money-=100;rishouru+=15;pen.text(money,13,50,0,-120,-130,14);pen.text(rishouru,13,50,0,-120,-185,14);pen.text("日收入+15元",13,40,0,-250,-20,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}else{pen.text("钱不够!",13,50,0,-250,-20,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}}if(buttonMP(7)){if(money>=500){money-=500;rishouru+=50;pen.text(money,13,50,0,-120,-130,14);pen.text(rishouru,13,50,0,-120,-185,14);pen.text("日收入+50元",13,40,0,-250,-20,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}else{pen.text("钱不够!",13,50,0,-250,-20,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}}if(buttonMP(8)){if(money>=50){money-=50;baoshidu+=20;pen.text("购买成功",13,30,0,-250,10,14);pen.text("饱食度+20",13,30,0,-250,-30,14);pen.text(money,13,50,0,-120,-130,14);pen.text(baoshidu,13,50,0,0,-325,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}else{pen.text("钱不够!",13,50,0,-250,-20,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}}if(buttonMP(9)){if(money>=100000){money-=100000;break;}else{pen.text("钱不够!",13,50,0,-250,-20,14);wait(1);p.moveTo(-250,-20).rr(290,150,14);}}if(i%25==0){money+=rishouru;pen.text(money,13,50,0,-120,-130,14);baoshidu-=rand(1,2);pen.text(baoshidu,13,50,0,0,-325,14);tianshu++;pen.text(tianshu,13,50,0,325,-30,14);}if(baoshidu<=0){pen.text("你饿了,无法工作。",13,30,0,-250,10,14);pen.text("日收入清零。",13,30,0,-250,-30,14);rishouru=0;pen.text(rishouru,13,50,0,-120,-185,14);pause(); p.moveTo(-250,-20).rr(290,150,14); }wait(0.075);}p.moveTo(0,0).rr(1000,1000,14).text("未完待续",5,200,0,0,200,14);p.text("敬请期待",5,200,0,0,-200,14);return 0;
}