VBGamer |
|||||||||||||||||||||||||||||||||||||||||||||||||||||
RE: sprites Peter (3 replies, 0 views) (2000-Jul-12) Do you mean loading each sprite (like each frame of animation) into its own surface? That's a bad idea =)
Its possible to just have a long strip of sprites in one file (and one surface) and only show one when blitting. To see an example just check out BiohazrdDD and look up the sub DDBltFastAnim. Its on the source code page on Voodoo VB (http://voodoovb.cjb.net)
Basically, if you have a sub to do your drawing, you can just manipulate the RECT to display the right frame or "sprite". In the call you would just specify the FrameNumber and FrameWidth.
Then to get the RECT you would just calculate it from those:
FrameRECT.Left=(framenumber*framewidth) - framewidth
FrameRECT.Right=framenumber*framewidth)
That would work for a long strip one frame wide. Like so:
* * * * * * * * * *
If you want a block, like with several strips on top of each other:
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
Then you would specify FrameNumberAcross, FrameNumberDown, FrameWidth, FrameHeight. Then you would calculate the RECT like this:
FrameRECT.Left=(framenumberacross*framewidth) - framewidth
FrameRECT.Right=framenumberacross*framewidth
FrameRECT.Top=(framenumberdown*frameheight)-frameheight
FrameRECT.Bottom=framenumberdown*frameheight
HTH
Peter
DDCK:Myth of Creation
www.talosstudios.com
|