I'm pretty new to programming and I have spent some time learning to use SDL in order to make a simple 2d game.
When I update the screen I blit the map/background and then I blit the moving things (player controlled character, etc) on top of it. I do this with a frame rate of 40 fps.
The problem is that this seems to cause lag. I think it would make sense to remove the blitting of the map (since the map doesn't change in every frame) and just blit the map ones at the start of the game. However, this will make the character leave a trail of blitted images behind (since they are left on top of the map).
My question is: is there a way to update the screen in a more efficent way, so the lag is reduced, without leaving the old images?