Adding Characters
From Web-Adventure-Kit-Wiki
WAK has their characters splitted in two parts. The entity character and the way they are displayed on the game, which is called Character's Display. In this way you can always use the same character and you can make a character change his look among scenes whenever you need it.
Contents |
[edit] Characters
The characters as entities are defined inside adventure/character/Characters.xml . And the file's structure is something like this.
And this is the definition of a character inside the <Characters> tag.
You can put any name on the ID. It allows you to refer the character later inside your Puzzle Controllers while scripting to make something like start a conversation with another character.
CharacterDisplay: The visual representation that the character will use by default and you can change it any time you want in scripts or in the scene. The CharacterDisplay is defined in CharsDisplay.xml and will be explained later.
Name: The name is only for cosmetics purposes in the interface. When you interact with this character in any way you will see the content of the Name field.
Description: A small description of the character that you can use from the script. Some adventure systems show it when you look at the character.
Inventory: The character's inventory at the begining of the game. The character will start with the items setted here. The items are previously defined by id in InventoryItems.xml.
SpeechColor: The color of the text used when this character speaks in the form of RRGGBB.
[edit] Character Display
The Character Display is a collection of DisplayObjects which defines how the character will look. There are tree kinds of character displays:
DummyCharDisplay: A display for testing scenes.
BmpCharDisplay: A display which works with tiled animations of bitmaps.
SwfCharDisplay: Not implemented yet but it will work with animations coming from MovieClips.
[edit] DummyCharDisplay
With this character display you will only see a red dot in the scene. It's used only for testing purposes when you want to try a scene but you don't have a character ready.
[edit] BmpCharDisplay
id: An identification id to reference this character display. scale: A scaling factor for width and height. frameDelay: The time in milliseconds that represents the duration of every frame in the animation.
Portrait: The resource id of a DisplayObject used as portrait of the character. This is used in adventure systems that have portraits for characters into their dialog system like in SCI.
Speed: The speed for the display when moving around the scene.
Animation: Is where an animation asset is asociated to a specific behaviour of the character. In the case of the BmpCharDisplay the asset provided as DisplayObject for the animation must be a bitmap.
behaviour: The id of a state of action performed by the character, for example: walk to the left (walkleft) . This is the list of built-in behaviours used by BmpCharDisplay: walkleft, walkright, walkfront, walkback, standingleft, standingright, standingfront, standingback, talkleft, talkright, talkfront, talkback. You can add new animations and assign it to a custom behavior for example to grab something on the floor and then ask to the character's display to set that behavior by calling SetAnimBehaviour method.
flipHorizontal: If true, the asset provided inside the Animation tag is flipped horizontally.
flipVertical: Idem to flipHorizontal. If true the asset is flipped vertically.
rows: BmpCharDisplay works with tiled images. This means that the frames of an animation are arranged in rows or columns inside the same bitmap. In rows you must to specify how many rows your tiled bitmap has.
cols: Is the same concept explained for rows applied to columns of the bitmap. If your animation has a single line of three frames one after another, then you have rows=”1” and cols=”3”.
offsetx: Is the amount of pixels in which the asset will be shifted horizontally inside the coordinate systems of the BmpCharDisplay. By default this is set to zero. You usually need it when the image is flipped.
offsety: Is the amount of pixels in which the asset will be shifted vertically inside the coordinate systems of the BmpCharDisplay. By default this is set to zero. You usually need it when the image is flipped.





