Trails

Started by
1 comment, last by frenchfry164 21 years, 8 months ago
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
"Make a world of your own" - Kurt Cobain
Advertisement
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 spritefor each character draw new sprite 
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 ]

This topic is closed to new replies.

Advertisement