getting sprites superposed on spritesheet
I am designing a game in which I have an animal on the center of the screen and I am trying to highlight some parts of the animal by changing the color using setRGB (in cocos2d). I have already decomposed the animal into several sprites and I am trying to re-build the animal on the screen. The problem is that I don't want to have to write all the coordinates of the different sprites and place them on the screen (I have over 20). So I am trying to make a spritesheet with superposed sprites out of them and change their color by just calling the appropriate sprite. Is there a software to do that ? I tried Zwoptex and texturePacker but they force the sprite to be next to each other, not开发者_如何学Python superposed. Can it be done ?
You can use zwoptex to do this.
Make your sprite (whole), lets pretend it is 100x100 in width and height.
Lets imagine there are 5 body parts, 2 legs, 2 arms and the torso/head.
Save out 5 identical images of your sprite, then erase all but the body parts required, (so on your first image, leave only the left arm etc)
Make sure they are saved out all exactly the same size (100x100), leaving all the transparent size as pure alpha.
When you bring these into zwoptex, it will remove the blank transparent space (saving your texture space on the spritesheet, but it remembers the sprite size).
So you can place all 5 sprites onto the same co-ordinate, and they will line up correctly, drawing your full sprite.
精彩评论