Recently i've been coding my own game, it was working fine up to a point but suddenly the backround is moving over the sprites drawn to the screen... I've loaded them unto the screen alright, and sometimes when i run they actually do come out on top. Here's my main:

import pygame, motherWhale, scoreBoard, babyWhale, seaWorld

def main():

    screen = pygame.display.set_mode((640, 480))
    pygame.display.set_caption("Bubble Battle")

    background = pygame.Surface(screen.get_size())
    background = background.convert()
    background.fill((255, 255, 255))
    screen.blit(background, (0, 0))''), 0.0)
    #musicPlaying = True

    motherwhale = motherWhale.MotherWhale()

    babywhale = babyWhale.BabyWhale()
    seaworld = seaWorld.SeaWorld()
    scoreboard = scoreBoard.Scoreboard()

    goodSprites = pygame.sprite.Group(motherwhale, babywhale) #seaworld, island, plane)
    backroundSprite = pygame.sprite.Group(seaworld) 
    scoreSprite = pygame.sprite.Group(scoreboard)

    clock = pygame.time.Clock()
    keepGoing = True
    while keepGoing:

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                keepGoing = False

            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE or event.key == pygame.K_q:
                    keepGoing = False

                if event.key == pygame.K_UP:
                    motherwhale.y -= 10   

                if event.key == pygame.K_DOWN:
                    motherwhale.y += 10

                #if event.key == pygame.K_RIGHT:

                    #motherWhale.x += 20

                #if event.key == pygame.K_LEFT:
                    #motherWhale.x -= 20

            elif event.type == pygame.KEYUP:
                if event.key == pygame.K_UP:                    #WHEN KEYPRESS LIFTED, STOP SPRITE
                    motherwhale.speed = 0

                elif event.key == pygame.K_DOWN:
                    motherwhale.speed = 0

                if motherwhale.y >= screen.get_width():
                    motherWhale.speed = 0

                if motherwhale.y >= screen.get_height():
                    motherWhale.speed = 0

                if motherwhale.rect.colliderect(babywhale.rect):

                    scoreboard.score += 1000

        #TODO: change to sprite.collideany

        goodSprites.clear(screen, background)
        scoreSprite.clear(screen, background)




if __name__ == "__main__":

I know they are being drawn to the screen but the backround goes over it... (note: It's nothing to do with the clear method)

This article has been dead for over six months. Start a new discussion instead.