• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            天行健 君子當(dāng)自強(qiáng)而不息

            Controlling Players and Characters(17)

             

            Resource Management


            Resource management plays a major role in your game. For characters to really get
            anywhere or achieve anything, they may need the aid of the items, spells, and other
            objects you’ve constructed for your game.

            In 游戲中物件的定義與使用 you see how to design your game’s
            items and place those items into a master item list. Now is the time to see what you
            can do with those items.

            Resources also include spells that your game’s characters can learn through the
            course of the game. You read more about spells later in this chapter in the section
            “Magic and Spells,” but for now, here is a glimpse of what resources can do for you.

             

            Using Items


            You’ve already seen how to control items in your game using a character inventory
            control system. If you have played with the CharICS demo, you have noticed the lack
            of function for the Equip and Use buttons. Now is the time to understand just what
            will happen when the functionality is put into place in that demo.

            A character can keep track of whatever armor, weapons, and accessories they can
            equip. Because those equipped items are contained within an sItem structure, you
            can query for the associated modified value (stored as sItem::Value) that is used to
            modify a character’s abilities.

            Say that item 1 is a sword. That sword is defined as a weapon and has a modified
            value of 10. If a character is allowed to equip the weapon (as determined by the
            class flags), the appropriate modified value is added to the character’s attack ability
            value. Tracking which item is equipped can be as simple as storing the item number
            in the character definition. Also, because you want to visually display the
            weapon that a character is holding, you might also load a weapon mesh to attach to
            the character.

            As for using items, that’s just as easy as equipping items. Remember that you predetermined
            what each item can be and what it can do. Say that you have a healing
            potion and your player decides to drink it. Once you have checked the usage
            restriction, you can determine that the healing potion is a healing item, and as
            such, adds the item modifier value to the player’s health points.

             

            Using Magic
             

            Magic spells, much like items, are an essential resource for a player’s survival.
            Magic aids the users in some way; stronger attacks, adding better defenses, and the
            ability to heal are typical magic spell fare. Although spells are not needed, they
            sure do help.

            Magic spells are defined just like items. They have an assigned feature. Some spells
            alter the character’s health, although other spells cause certain status ailments
            (such as Poison). Any character can harness magic; they just need to “know” the
            spell and have the matching mana points to cast it.

            In order for characters to know a spell, they must learn it by working through experience
            levels. You can track learned spells by using the bit flags. You can use a 32-bit
            variable to store known spells, with each bit in the variable representing a specific
            spell. By setting a bit in the variable, the spell is learned. Once a spell is learned, it
            is typically known forever.

            Managing spell usage is just like managing items; by displaying a list of spells known
            by a character, the player can determine which spells to cast when and where.


            posted on 2007-11-14 21:04 lovedday 閱讀(161) 評論(0)  編輯 收藏 引用


            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            公告

            導(dǎo)航

            統(tǒng)計(jì)

            常用鏈接

            隨筆分類(178)

            3D游戲編程相關(guān)鏈接

            搜索

            最新評論

            一级做a爰片久久毛片免费陪| 久久天天躁狠狠躁夜夜avapp| 国产午夜精品久久久久九九电影| 国产69精品久久久久99尤物| 日韩精品无码久久一区二区三| 久久综合狠狠综合久久综合88| 亚洲国产精品久久久久婷婷软件| 天堂无码久久综合东京热| 漂亮人妻被黑人久久精品| 久久se精品一区精品二区国产| 亚洲综合伊人久久大杳蕉| 久久国产美女免费观看精品 | 久久久老熟女一区二区三区| 久久夜色tv网站| 久久丫精品国产亚洲av不卡| 精品国产日韩久久亚洲| 国产成人99久久亚洲综合精品| 久久精品夜夜夜夜夜久久| 人妻无码精品久久亚瑟影视| 中文字幕亚洲综合久久| 91精品国产91久久久久福利 | 青青草原精品99久久精品66| 国产精品成人久久久| 精品乱码久久久久久夜夜嗨 | 国产精品内射久久久久欢欢| 嫩草伊人久久精品少妇AV| 国产精品一区二区久久精品涩爱| 久久亚洲国产中v天仙www| a高清免费毛片久久| 久久精品a亚洲国产v高清不卡 | 亚洲国产精品久久66| 99久久中文字幕| 国产精品久久国产精麻豆99网站| 色偷偷88888欧美精品久久久| 五月丁香综合激情六月久久| 狠狠色婷婷久久一区二区| 亚洲国产一成人久久精品| 久久精品aⅴ无码中文字字幕不卡| 日韩人妻无码精品久久免费一 | 久久婷婷人人澡人人爽人人爱| 久久久久波多野结衣高潮|