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
pygame.init()


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))


    #pygame.mixer.music.load('')
    #pygame.mixer.music.play(-1, 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:
        clock.tick(30)



        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):

                    babywhale.reset()
                    scoreboard.score += 1000


        #TODO: change to sprite.collideany






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

        goodSprites.update()
        backroundSprite.update()
        scoreSprite.update()

        goodSprites.draw(screen)
        backroundSprite.draw(screen)
        scoreSprite.draw(screen)

        pygame.display.flip()





if __name__ == "__main__":
    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)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.