loudo Posted February 13, 2014 Report Share Posted February 13, 2014 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. Quote Link to comment Share on other sites More sharing options...
lucid Posted February 14, 2014 Report Share Posted February 14, 2014 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. Quote Link to comment Share on other sites More sharing options...
loudo Posted February 15, 2014 Author Report Share Posted February 15, 2014 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 ? Quote Link to comment Share on other sites More sharing options...
lucid Posted February 16, 2014 Report Share Posted February 16, 2014 correct Quote Link to comment Share on other sites More sharing options...
loudo Posted February 16, 2014 Author Report Share Posted February 16, 2014 Thank you very much for your time. Quote Link to comment Share on other sites More sharing options...
lucid Posted February 16, 2014 Report Share Posted February 16, 2014 no problem Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.