Game Development Community

solution - adding items- shields guns swords etc to 2d sprites

by michael bailey · in Torque Game Builder · 03/10/2009 (3:15 pm) · 1 replies

I just got torque game builder yesterday but never really found a solution to this question posted multiple times. IT is very very easy to do this, although time consuming on the art side of it.

step 1 - i used poser to export a 60 degrees(cam angle) walking animation and made a 9 frame loop out of the walking pngs. just a basic male walking model.

#2 I assume you are making the character sheet in a program such as adobe. for my test i made a shield for his left hand, add a layer above your walking cycle. paste in your shield on a layer above. size orient it to your liking on each frame. Hide the character animation layer, this leaves just the shield this is what we want to export. save as png. so now you have shield that mimics the walking animation . make SURE u set the speed to the same on both while creating your animation. set your player sprite to a decent level say 15. your shield to the layer just above your player.

\---------------note walking right would require under side of shield and putting it behind the character sprite --------------------

#3 so you have your sprite lets call him adam on the screen i positioned my shield off the screen (just for this simple example)

#4 name your player sprite pAdam so you can use himin script.

#5 name your shield iSheild

and basically there is only 1 line of code to make the equip work

iShield.setPosition(pAdam.getPositionX(),pAdam.getPositionY());

you can add an item array add custom fields to the shield collision whatever.


just use this to update when your player is moving and there you have an equipped shield.

i should add you have to do this for all animations so that it works right. especially if you are doing a game looking like adventure kit.

attach sword to right arm just follow the same process and put it under the layer of the adam sprite. easy huh?

#1
03/14/2009 (9:52 pm)
Thanks Michael! I've just started trying to use poser to export isometric figures, so this will be a big help.