纯c语言写地一个小型游戏 源代码

纯c语言写地一个小型游戏 源代码

ID:35689608

大小:121.50 KB

页数:15页

时间:2019-04-12

纯c语言写地一个小型游戏 源代码_第1页
纯c语言写地一个小型游戏 源代码_第2页
纯c语言写地一个小型游戏 源代码_第3页
纯c语言写地一个小型游戏 源代码_第4页
纯c语言写地一个小型游戏 源代码_第5页
资源描述:

《纯c语言写地一个小型游戏 源代码》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、/*Asimplegame*//*CopyRight:Guanlin*/#include#include#include#include#include#include structobject_fix{charname[20];charid[5];chardesc[500];charaction[30];charim[5];};structobject_move{charname[20];ch

2、arid[5];chardesc[500];intloc;intpwr;intstrg;charim[5];};structrover{charname[20];charid[5];chardesc[500];intpwr;intstrg;intlocation[2];charim[5];};structmap/*thisisthemapstructure*/{chardata[20];charadd_data[20];intamount;intx;/*thiswerethesuccessorkeepsit

3、'sx&yvalues*/inty;};structlocation/*thisstructureisforthesuccessorlister*/{floatheight;charobj;};voidstats_update(intselected,structrover*p_rover){switch(selected){case1:if(p_rover->pwr<7)printf("Youdonothaveenoughpowertoperformthisaction!");else{(

4、p_rover->pwr)-=7;printf("Youhavedestroyedtheobject!");}break;case2:if(p_rover->pwr<3)printf("Youdonothaveenoughpowertoperformthisaction!");elseif(p_rover->strg>90)printf("Youdonothaveenoughstoragespaceforthisobject!");else{(p_rover->pwr

5、)-=3;(p_rover->strg)+=10;printf("Youhavecollectedasampleoftheobject!");}break;case3:p_rover->pwr-=10;/*Distancearoundobject-valuegainedfrommappermodule.1square=-1power*/printf("Youhaveavoidedtheobject!");break;case4:p_rover->pwr-=2;printf("Youhaved

6、riventhroughtheobstacle!");break;case5:if(p_rover->pwr==100)printf("Youdonotneedtochargeup!");else{p_rover->pwr=100;printf("Youhavechargedupyourrover!");}break;default:printf("*****ERROR*****InvalidSelection");break;}}voidaction(c

7、harobject,structrover*p_rover){intselection;switch(object){case1:printf("Youhaveencountered:ASandyRock");printf("Thisobjectcanbe:1.tDestroyed2.tCollectedPleasechooseaction1or2:t");scanf("%d",&selection);stats_update(selection,p_rover);break;

8、case2:printf("Youhaveencountered:ASolidRock");printf("Thisobjectcanbe:1.tAvoided2.tCollectedPleasechooseaction1or2:t");scanf("%d",&selection);if(selection==1)selection=3;stats_update(selection,

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。