Archived

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

This topic is 5602 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

Now I know trails are a simple thing to fix, just usually clearing a screen, but this is not the standard clear screen issue. I have a tile engine up and running. I just started the NPC movement routines, and I''m getting trails. I don''t redraw the map every frame, because it slows the game down a lot. So it refreshes the map every 7 frames. During those periods that the map isn''t being redrawn, there are trails behind the NPC''s, because, of course, the map isn''t being redrawn every frame. I thought about redrawing a 4x4 box of tiles around the character everytime he moves. Then I thought to just draw the opposite direction you are walking, so it won''t sacrifice as much speed (not very noticable, but I need every frame I can get ). But if another NPC moves in the area that it redraws, then it''ll temporarily disappear. Any suggestions? PS: I am using Allegro 4.0

Share this post


Link to post
Share on other sites
If you are currently implementing it like this:


for each character
clear old sprite
draw new sprite


Change it to this way instead:


for each character
clear old sprite

for each character
draw new sprite

Share this post


Link to post
Share on other sites
You only ever need to redraw the tiles that are currently obscured by your sprite. You can work those out from your sprite''s position and size. With a sprite the same size as the tiles, you never need to redraw more than 2x2.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]

Share this post


Link to post
Share on other sites