It looks like you never clear the screen. try something like:
def drawBoard():
   self.screen.fill( (128,128,128) )
   blit background to display
   for piece in fallenPieces:
        blit piece to display
  display.flip()

Why do you split sprites into two groups? ( stopped, and moving )

(Not sure if that will exactly integrate into how your code, is, but
this is what I mean):

class TetrisMain():
        def __init__(self):
                """init pygame, surfaces, sprite groups"""
                self.screen = #pygame screen
                self.pieces_list = #sprite group filled with pieces
                
        def draw(self):
                """clear, blit background, blit pieces, flip."""
                self.screen.fill((128,128,128))
                self.screen.blit( self.background, (0,0))
                self.pieces_list.draw(self.screen)
                pygame.display.flip()
                
        def loop(self):
                """main loop"""
                self.pieces_list.update() # update using sprite group
                self.draw()

On Wed, Dec 31, 2008 at 8:47 PM, Michael Phipps
<[email protected]> wrote:
> 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
>



-- 
Jake

Reply via email to