When moving the sprites they leave a copy of them on the place of the screen where they were before they moved, so finally the screen is full of trash,how can I avoid that?
When moving the sprites they leave a copy of them on the place of the screen where they were before they moved, so finally the screen is full of trash,how can I avoid that?
---Programming is like roaming, you never know where you'll end at------
If 'here' is pronounced as 'hear', why 'there' isnt pronounced as 'dear'??
[email protected]
This is JoshG, umm, try clearing the screen.
isnt there a better way ?
---Programming is like roaming, you never know where you'll end at------
If 'here' is pronounced as 'hear', why 'there' isnt pronounced as 'dear'??
[email protected]
Essentially you are going to have to clear the screen, but there is a better way to do so than - clear(screen).
This example is going to be if you want to use a 640x480 bitmap as your background.
If you use this as your algorithm for drawing to the screen it will be erasing the old information on the buffer (not the screen), putting the new information on the buffer, and finally putting the buffer information to the screen. This will, also, prevent flickering on the screen by using the buffer.Code:blit(background, buffer, 0, 0, 0, 0, SCREEN_W, SCREEN_H); draw_sprite(sprite, buffer, x, y); blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);