Archive for July, 2011

Dynamic Character Sprites

This weekend, I separated out my character sprites into individual body parts. It didn’t prove to be too difficult for the artwork, but programatically speaking it was a bitch to do. Well worth it in the end tho; the sprite structure can be inherited by any character, and equipped items will now change the character’s physical appearance. Not to mention, it’s very memory-efficient!

Each sprite is split into the following sub-sprites: Head, Body, Legs, LeftShoe, RightShoe, LeftArm, RightArm, Weapon, Accessory. Here’s a sprite set that shows what I’m talking about

DESIGN:
I do everything in Illustrator now (no need to export to Photoshop). Even image slicing is easy!

Player Sprites

…decapitated characters are a good thing!

CODE:

Player Sprite Code

Each sub-sprite is added to a sprite display group (i.e. player.sprGrp), given it’s own reference name in the sprite object (i.e. player.sprite.body), and positioned independently based on the current state of the character (i.e. jumping, walking, etc). The downside: for each state, I have to manually position each body part. The upside: I only gotta do it once for each state.

Tweet9 #IndieGameDev

#Getting back into programming mode. Had a great vacation, now there’s work to do…