Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Flipping sprites

This topic is 6233 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I''m doing a small game and I need my sprites to have 32 directions of movement but I dont want to draw each sprite separately. I was planning to draw the 8 possible positions from 0 - 90 degrees and flip the sprite either horizontally or vertically to get the full range of 32 directions at runtime. My problem is I dont know if I can get the Direct Draw Blitter to flip the sprite before it draws it to the target surface. Can anyone tell me if there is something I can do with the blitter to flip a bitmap horizontally or vertically or will I have to do it myself? Thanks, -F

Share this post

Link to post
Share on other sites
if you're going to be storing all 32 sprites in system memory at the same time, why not just rotate them bofore you load them? rotating them is pretty easy in most graphics editors. (even in Paint which comes with Windows)


Edited by - Julio on June 26, 2001 1:13:55 PM

Share this post

Link to post
Share on other sites
If you''re using DX 7:

ZeroMemory(&ddb, sizeof(DDBLTFX));
ddb.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT; // for horizontal flip
ddb.dwDDFX = DDBLTFX_MIRRORUPDOWN; // for vertical flip
LPRECT lpDestRect,
LPRECT lpSrcRect,
DWORD dwFlags,
LPDDBLTFX lpDDBltFx // <<<---- Use here

If you''re using DX 8 sprite, then just flip the left/right and top/bottom variables in the source rectangle structure of ID3DXSprite::Draw.


Share this post

Link to post
Share on other sites
Thanks guys,
that''s exaclty what I was looking for. I''m going to draw a bitmap of 16 directions from 0-90 degrees and load that onto a surface then flip it as necessary when I Blt the sprite to the screen.



Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!