I am finishing up my first pygame; everything has been fun and easy except this:
The game is a tetris-like game (with a twist). I have the falling piece as a
sprite. The background is just a bitmap. The pieces that have already fallen, I
blit into place. So I have something like (in pseudo code):
def drawBoard():
blit background to display
for piece in fallenPieces:
blit piece to display
display.flip()
while 1: # game loop
moveSprite()
if sprite.nextLocation == taken
fallenPieces.Append(sprite.asPiece())
sprite = None
removeSolidRows() # This removes fallen pieces that have formed
complete rows
drawboard()
The problem that I have is that as the sprite is falling, I can see rows that
have been removed. I have confirmed that drawBoard() is doing the right thing -
when the sprite hits the bottom and the screen redraws, the ghosts disappear.
They are only there when the sprite floats over them. It looks like the sprite
is getting the data from the old version of the screen (i.e. before the last
piece fell and rows were removed) to redraw the screen's dirty regions.
Help!
Michael