Jump to content

Character Mapping


loudo

Recommended Posts

I'm trying to understand how I can implement the Character Mapping in as3 and haxe libraries.

Is this feature is fully implemented in the software ?

How can I implement this in the library ?

I'm not sure there are enough details in the SCML ref for this feature. Can you help ?

Thanks.

Link to comment
Share on other sites

hi loudo,

Here's the basic way it works.

Take the actual structure from the scml file, and put them in an array or tree structure.

I'll just use file names for these examples to make it more readable, but you should copy all of the file info, including pivots, etc:

originalFiles
[
head.png
chest.png
legs.png
]

Keep this tree/array for when you want to remove all character maps at some point in the game, and reset to the default state.

Your runtime should access a copy of this array when switching sprites, instead of the original. We'll call this copy activeCharacterMap

activeCharacterMap
[
head.png
chest.png
legs.png
]

Now each character map in your file will basically a set of instructions on how to change the activeCharacterMap

here's an example:



The map means to replace that 'folder'/'file' with the 'target_folder'/'target_file',

So if the 'folder''file' referred to above was head.png, and the target_file was robotHead.png

your active map looks like this:


activeCharacterMap
[
robotHead.png
chest.png
legs.png
]

if the map is missing the target_folder and target_file then any sprites using that image should be hidden:




so now your active map would be:

activeCharacterMap
[

chest.png
legs.png
]

At any time during the game you can reset your activeCharacterMap back to the default by copying over that original array.

You can also stack character maps on top of each other and would produce the same results as stacking them in Spriter. For example, if one character map replaced the entire body and head with reptile skin, and then you added a second character map that replaced the head with a helmet, you would end up with your character having reptile skin AND wearing the helmet.

Please let me know if this helped.

Link to comment
Share on other sites

Thanks lucid.

I did it. I have an animation working with character mapping. :)

So, let's checking if I did it correctly :

To display an image on screen, we take the folder's id and the file's id in the SpriteTimelineKey class, and then we use folders's array or activeCharacterMap's array stored in the ScmlObject class to retrieve the file name, right ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...