第一章 脚本编程概论.pptVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
第一章脚 本编程概论 本章内容 1、 脚本编程及实现方法 直观方法存在的问题 解决方法 脚本 2、 脚本编程系统的类型 1、 脚本编程及实现方法 以游戏开发的过程来做说明 编写设计文档 确定游戏引擎 美工要素 声音和音乐 最重要的:游戏的内容 直观方法 想美术、程序一样,游戏内容处理的处理也需要专用工具 方法一:程序员在游戏引擎中手工编写所有的代码 以定义游戏物品为例 typedef struct _Item { char * pstrName; // What is the item called? int iType; // What general type of item is it? int iPrice; // How much should it cost in shops? int iPower; // How powerful is it? } Item; 其中的物品功能常量一般要事先定义,例如可以这样 const HEAL = 0; const MAGIC_RESTORE = 1; const ARMOR_REPAIR = 2; const TELEPORT = 3; 下面来应用这个结构 const MAX_ITEM_COUNT = 128; // 128 items should be enough Item ItemArray [ MAX_ITEM_COUNT ]; // First, lets add something to heal injuries: ItemArray [ 0 ].pstrName = Health Potion Lv 1; ItemArray [ 0 ].iType = HEAL; ItemArray [ 0 ].iPrice = 20; ItemArray [ 0 ].iPower = 10; // Next, wizards and mages and all those guys are gonna need this: ItemArray [ 1 ].pstrName = Magic Potion Lv 6; ItemArray [ 1 ].iType = MAGIC_RESTORE; ItemArray [ 1 ].iPrice = 250; ItemArray [ 1 ].iPower = 60; // Big burly warriors may want some of this: ItemArray [ 2 ].pstrName = Armor Elixir Lv 2; ItemArray [ 2 ].iType = ARMOR_REPAIR; ItemArray [ 2 ].iPrice = 30; ItemArray [ 2 ].iPower = 20; // To be honest, I have no idea what on earth this thing is: ItemArray [ 3 ].pstrName = Orb of Sayjack; ItemArray [ 3 ].iType = TELEPORT; ItemArray [ 3 ].iPrice = 3000; ItemArray [ 3 ].iPower = NULL; 测试可能遇到的问题 A、第一个对象的health值不合适 B、多个物品见明显不能达到平衡 直观的解决办法:直接修改对象的值,然后重新编译。 缺点:即使改变很小,也需要巨大的重新编译工作; 大量对象的组织将非常复杂 疑问:为什么美工改变他的工作内容不需要重新编译? 原因:实现思想不合适 解决方法 方法二、逻辑和具体实现相分离 游戏引擎和游戏的内容可以分别修改,互不干涉。 它们存放于不同的文件,唯一相关的就是从磁盘读数据的部分。 1. Open the file and determine which index of the item array to store its contents in. You’ll probably be loading these in a loop, so it should just be a matter of referring to the loopcounter. 2. Read the first string and store it in pstrName. 3. Read the next line. If the line is “HEAL”, assign HEAL to iType. If

文档评论(0)

fc86033 + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档