animated image question

BlitzMax Forums/BlitzMax Programming/animated image question

tin(Posted 2008) [#1]
[IMG]http://img169.imageshack.us/img169/2474/customerf001eatzp8.png[/IMG]
the above image is taken from yahoo game, Family Restaurant,.
there not complete full frame is drawn for animated frames.
if mouth move, only mouth is drawn in a frame, for hand only drawn hand in frame.

what i want to know is, what's the different between the full completely drawn frame vs only animated portion of frame with lots of transparency?

oh. BTW, how can i show my images in this forum? what's the TAG for it?


tonyg(Posted 2008) [#2]
I think I know what you're asking.
That method can be used for Composite Sprites which allow you to build different characters from different base elements and/or you can animate the characters by rotating/moving each of the elements rather than drawing separate frames.
e.g. Rotate the leg about a hip joint for a kick rather than have separate images of the leg down, leg half-way up and leg in full kick position.
What are the forum codes


tin(Posted 2008) [#3]
sorry, image is here,


BTW, how can i show my image in forum?


tin(Posted 2008) [#4]
Oppss!!!
i just put image link in here, and it shows...
i tought, i need to use like [img] tags.. :D he he


tonyg(Posted 2008) [#5]
OK, so it's a composite anim. For example, Rather than draw the whole girl with her eyes open and again blinking, just the eyes are overdrawn.
<edit> You save on time to draw the images and space either in memory or on disk.


Derron(Posted 2008) [#6]
Using such image-strips needs a different approach than "loadanimimage".

For each sprite an offsetX, offsetY, width and height is needed. Loading only parts of the image (within the given coords) will save some memory of gpu and ram. Encapsulating this in your own types you can have some fields storing the offsets to enable drawing like:

drawimage(img_body, x,y)
drawimage(self.partimage, x + self.offsetx, y + self.offsety)


The difference to the standard method is: if you also save coords for rotation and so, you can create more animation poses (like tonyg said) but you will have to code way more to gain some memory savings.

If you render all your sprites of from 3d models, I would not use this way because it's easier to manipulate it in your 3D-App. Only if you use straight bitmap-editing (no vectors) this approach seems needful.

Another thing: this method is only useful if your sprite is finished. Making changes after you split down your frames is painful because again a "select, copy, paste" is needed. Ok, if you have 1 sprite its not that worse, but imagine having 100 sprites which need a slight change.

But before I forget to mention it: i saw this "composite sprites"-method in some casual games (ok I had to extract them from packed files ... so I don't know how they linked them together). They even used it for sprites of 24x24 dimensions - with closing eyes as separate images with 6x6. They used it for all sprites of figures they had. I think they have done more work in coding than in making the sprites. Sometimes it is just easier to still use the method of each frame being completely and not being created out of different parts.

Ok enough of it - most of my post just got offtopic ;D.

bye MB


TomToad(Posted 2008) [#7]
Here's some code I whipped up using the above image. Hope it helps.