ImageVerifierCode 换一换
格式:DOCX , 页数:21 ,大小:19.71KB ,
资源ID:17335993      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/17335993.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(纯C语言写的一个小型游戏 源代码文档格式.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

纯C语言写的一个小型游戏 源代码文档格式.docx

1、int location2;struct map /* this is the map structure*/char data20;char add_data20;int amount;int x; /* this were the successor keeps its x & y values*/int y;struct location /*this structure is for the successor lister*/float height;char obj;void stats_update(int selected, struct rover *p_rover)swit

2、ch (selected)case 1:if(p_rover-pwr pwr) -= 7;You have destroyed the object!break;case 2: 3)else if(p_rover-strg 90)nnYou do not have enough storage space for this object!pwr) -= 3;strg) += 10;You have collected a sample of the object!case 3:p_rover-pwr -= 10; /*Distance around object- value gained f

3、rom mapper module. 1 square = -1 power*/You have avoided the object!case 4:pwr -= 2;You have driven through the obstacle!case 5:pwr = 100)nnYou do not need to charge up!pwr = 100;You have charged up your rover!default:nn*ERROR*nInvalid Selectionnnvoid action(char object, struct rover *p_rover)int se

4、lection;switch(object)nYou have encountered: A Sandy RocknnThis object can be:n1.tDestroyedn2.tCollectednPlease choose action 1 or 2:tscanf(%d, &selection);stats_update(selection, p_rover); A Solid Rocknnn1.tAvoidedn2.tCollectednPlease choose action 1 or 2:if (selection = 1)selection = 3; A Mountain

5、nnn1.tAvoidednPlease enter 1: Dustnnn1.tDriven throughn2.tCollectednPlease choose action 1 or 2:selection = 4; A Sheer Valleynncase 6: A Gentle Valleynnn1.tDriven throughn2.tAvoidednPlease choose action 1 or 2:if (selection = 2)case 7: A Martian Treennn1.tDestroyedn2.tCollectedn3.tAvoidednPlease cho

6、ose action 1, 2 or 3:case 8: Shallow Waternnn1.tDriven throughn2.tCollectedn3.tAvoidednPlease choose action 1, 2 or 3:case 9: Deep Waternncase 10: An Aggressive Aliennnn1.tDestroyednPlease enter 1:selection = 1;case 11: A Non-Aggressive Aliennncase 12: Another Rovernncase 13: A Power StationnnYou ca

7、n:n1.tCharge upn2.tAvoidnPlease choose action 1 or 2:selection = 5;nn*ERROR*nnvoid show_map(struct map *number, struct map *number_2, struct object_fix *rsny, struct object_fix *rsld, struct object_fix *mnt, struct object_fix *dst, struct object_fix *vshr, struct object_fix *vgnt, struct object_fix

8、*mtre, struct object_fix *wshl, struct object_fix *wdp, struct object_move *aagr, struct object_move *anon, struct object_move *rvr, struct object_move *pstn, struct rover *p_rover) /*the show map function calling number and number_2 from the map structure to see if moveable objects are needed*/stru

9、ct map f_map88; /*8 by 8 map*/int i,j, rx, ry, object; /*this is your x and y value in your map (f_map)*/system(cls /* this is your x and y value in your map (f_map)*/srand(time(NULL); /*calling the time from include to gather random variables*/for(i=0;i8;i+) /*for loop to copy all your fixed object

10、 lists into f_map so they can be displayed*/for(j=0;jamount0) /*this is looking at the add function to see weather or not there are aliens in f_map*/number-amount;i+) /*allocating the number of aliens in f_map*/strcpy(f_maprand()%8rand()%8.data, anon-im); /*randomizing their position*/if(number_2-0)

11、 /*repeat of above just for rovers instead*/number_2-i+)strcpy(f_maprand()%8rand()%8.data, rvr-rx= p_rover-location0;ry= p_rover-location1;strcpy(f_map10.data, wdp-strcpy(f_map40.data, mnt-strcpy(f_map50.data, mnt-strcpy(f_map31.data, dst-strcpy(f_map41.data, dst-strcpy(f_map32.data, dst-strcpy(f_ma

12、p42.data, dst-strcpy(f_map03.data, mnt-strcpy(f_map13.data, mnt-strcpy(f_map33.data, vshr-strcpy(f_map43.data, dst-strcpy(f_map53.data, vgnt-strcpy(f_map34.data, vshr-strcpy(f_map44.data, dst-strcpy(f_map54.data, vgnt-strcpy(f_map25.data, wshl-strcpy(f_map35.data, wshl-strcpy(f_map45.data, wshl-strc

13、py(f_map16.data, pstn-strcpy(f_map26.data, wdp-strcpy(f_map36.data, wdp-strcpy(f_map46.data, wshl-strcpy(f_map76.data, mnt-strcpy(f_map07.data, mnt-strcpy(f_map17.data, wdp-strcpy(f_map27.data, wshl-strcpy(f_map37.data, wshl-strcpy(f_map67.data, mnt-strcpy(f_maprxry.data, p_rover-if(rx = 1 & ry = 0)

14、 | (rx = 2 & ry = 6) |(rx = 3 & ry = 6) |(rx = 1 & ry = 7)object = 9;action(object, p_rover);else if(rx = 4 & ry = 0) | (rx = 5 & ry = 0) | (rx = 0 & ry = 3) | (rx = 1 & ry = 3) | (rx = 7 & ry = 6) | (rx = 0 & ry = 7) | (rx = 6 &object = 3;else if(rx = 3 & ry= 1) | (rx = 4 & ry = 1) | (rx = 3 & ry=

15、2) | (rx = 4 & ry = 2) | (rx = 4 & ry = 3) | (rx = 4 & ry = 4)object = 4; ry = 3) | (rx = 3 &object = 5;else if(rx = 5 & ry = 3) | (rx = 5 &object = 6;else if(rx = 2 & ry = 5) | (rx = 3 & ry = 5 ) | (rx = 4 & ry = 5) | (rx = 4 & ry = 6) |(rx = 2 & ry = 7) | (rx = 3 &object = 8;else if(rx = 1 & ry =

16、6)object = 13;i=0; /*re-allocate i to 0 so map is printed from start*/i+) /*8 by 8 map*/ +-+-+-+-+-+-+-+-+nj+) /*8 by 8 map*/if(strlen(f_mapij.data)!=0) /*if function to print nothing but 4 spaces if there in nothing allocated in ij*/|%4s,f_mapij.data);| /*end of coloumn visible map*/ |n /*end of la

17、st coloumn visible map*/ /*bottom of map*/n270Group Bnvoid add_obj(struct map *number, struct map *number_2, struct object_fix *rsny, struct object_move *anon, struct object_move *rvr, struct object_move *pstn, struct rover *p_rover) /* add movable object function, *number=aliens, *number_2=rovers*/int object, t, f;char alien;char rover;This is the add movable object functionnhow many aliens would you like?sc

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1