Animation

BlitzPlus Forums/BlitzPlus Beginners Area/Animation

1) Lets say your man is 32 pixels wide and 64 pixels tall, this would be 1 frame (a rectangle). You may need something like 8 frames or more (each showing a slightly different picture) to give the impression of walking (animation). So make a bitmap in paintshop pro or something that is 8x32 pixels wide and 64 pixels tall. You will find it useful to draw 8 rectangles (32 pixels wide) side by side on the blank bitmap. Then you can draw each frame within the rectangles. There are also some tricks to making the man walk smoothly (the same amount each frame) but that's for another day.

2) Now use LoadAnimImage and use the parameters to say you have 8 frames, and each are 32 pixels wide.

3) Make a variable in your program that says which frame the man is on i.e. start it at 0 and when it goes past 7 put it back to 0. Then when you draw your man with DrawImage, just show the correct frame. You will need a decent delay between each frame (i.e. when you add one to the variable mentioned earlier) or he will walk way too fast.

Your man is a "sprite" this is an object that moves around and interacts with the game world. Other sprites are enemies and bullets etc. Background scenery is not a sprite unless it is a moving lift or something. There are no "Sprite" commands as such in Blitz, it is just a very old game programming term.

hope this helps