Archived

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

mickey

2D animation advice/tecnique

Recommended Posts

mickey    100
hi! i''d like to do a 2d anim without blitting the background everytime i blit the sprite, how will i do that? thanks in advance!

Share this post


Link to post
Share on other sites
mickey    100
oh and one more thing, i alredy tried doing this by directly blitting to the primary surface but everytime my sprite moves, it left behind trails... hope you got the picture, thnkas again!

Share this post


Link to post
Share on other sites
intrest86    742
I don''t know why you would want to do this, but you could copy the rect of the background where you blit your character first, and then blit the copy back over that spot the next frame.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
hahaha that''s just what i did intrest86 thanks very much! do you know any other tecniques?

Share this post


Link to post
Share on other sites
mickey    100
and intres86, one more thing, why, doesn''t anybody really do this? do animation directly to the primary surface? doesn''t it make things a bit faster coz you don''t have to blit everything all else up?

Share this post


Link to post
Share on other sites
hammerstein_02    134
Doesn''t that waste memory, catching the area of the screen you are about to move to. Computers are so fast now, blitting a background isn''t going to effect your performance that much. And if you have that much on screen that you think blitting the background will slow the refresh down, won''t wasting the memory holding a part of the screen by? Please correct me if I am wrong here.

Share this post


Link to post
Share on other sites
Darkor    134
You''ll have to clear the screen. Obviously, the trails are left by the blitting of your sprite, which stays there until you clear it.

There are many ways to clear the screen but you''ll do fine blitting an entire background. I don''t know what API you''re using, so I can''t tell you how to clear the screen exactly.

Do not blit to the primary surface directly, because, this is being accessed by the hardware. Thus, your scene might appear on screen before it''s done. This might not be a problem today on a small game. But it will cause flickering or something, especially on older computers runing a demanding game. Just blit to the back buffer and flip it when you''re ready.

Share this post


Link to post
Share on other sites
mickey    100
okey guys thanks!!!

yes, the blitting is very very very fast, so there no problem blitting everything else all up! (of course, like darkor said, to the backbuffer)

am using api, we use the DDBLTFX structure to do a colorfill,

Share this post


Link to post
Share on other sites
mickey    100
okey guys thanks!!!

yes, the blitting is very very very fast, so there no problem blitting everything else all up! (of course, like darkor said, to the backbuffer)

am using DX, we use the DDBLTFX structure to do a colorfill,

Share this post


Link to post
Share on other sites