How do you make a sprite appear in pygame/python?
Question: I'm trying to make a basic (Mario style) game but my sprite(plumber) doesn't
appear, it could be hidden behind background? i'm not exactly sure, i am not
getting any errors either.

    
    
    import pygame
    import sys
    import itertools
    import pygame
    from pygame.sprite import Sprite
    
    cloud_background = pygame.image.load('clouds.bmp')
    brick_tile = pygame.image.load('brick_tile.png')
    
    pink = (255, 64, 64)
    w = 640
    h = 480
    screen = pygame.display.set_mode((w, h))
    running = 1
    
    def setup_background():
        screen.fill((pink))
        screen.blit(cloud_background,(0,0))
        brick_width, brick_height = brick_tile.get_width(), brick_tile.get_height()
        for x,y in itertools.product(range(0,640,brick_width),
                                     range(390,480,brick_height)):
            # print(x,y)
            screen.blit(brick_tile, (x, y))
        pygame.display.flip()
    
    while running:
        setup_background()    
        event = pygame.event.poll()
        if event.type == pygame.QUIT: sys.exit()
    
    class plumber(sprite):
        def __init__(   
            self, screen, img_filename, init_position, 
            init_direction, speed):
    
            Sprite.__init__(self)
    
            self.screen = screen
            self.speed = speed
    
            self.base_image = pygame.image.load(Mario_sideways_sprite_2xL.png).convert_alpha()
            self.image = self.base_image
    
    
            self.pos = 50,50
    


Answer: First problem found is that you must modify

    
    
    pygame.image.load(Mario_sideways_sprite_2xL.png)
    

with something like.

    
    
    pygame.image.load("Mario_sideways_sprite_2xL.png")
    

Besides this, the code has many problems that impedes it to work. For example,

  * **you do not instantiate your plumber class**.
  * `class plumber(sprite)` should be `plumber(Sprite)` (still better `Plumber(Sprite)`) 

You need something like:

    
    
    myplumber = Plumber()
    allsprites = pygame.sprite.RenderPlain((myplumber, ....))
    clock = pygame.time.Clock()
    

You could see [here](http://pygame.org/docs/tut/chimp/ChimpLineByLine.html)
the main parts of a simple program like yours.

