• ### Announcements

#### Archived

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

# Trails

## 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 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 spritefor each character draw new sprite

##### 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 ]

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627689
• Total Posts
2978659

• 18
• 14
• 12
• 10
• 12