#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    1
    Rep Power
    0

    Only Displays a black screen, no graphics or blitted objects PYTHON PYGAME


    Code:
    ...
    ALIVE=False
    PLAYER=pygame.image.load("ball.gif")
    ENEMY=pygame.image.load("ship.gif")
    
    
    
    def main():
        global FPS, KILLS, DEATHS, STATUS, HEIGHT, WIDTH, ENEMIES, ALIVE
    
        pygame.init()
        FPSCLOCK=pygame.time.Clock()
        DISPLAYSURF=pygame.display.set_mode((WIDTH, HEIGHT))
        pygame.display.set_caption("Space Battle!")
    
        while True:
            checkForQuit()
            DISPLAYSURF.fill(BLACK)
            DISPLAYSURF.blit(PLAYER, (PLAYERX, PLAYERY))
            DISPLAYSURF.blit(ENEMY, (ENEMY1X, ENEMY1Y))
    ...
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    138
    Rep Power
    2
    Originally Posted by aidenkael
    Code:
    ...
    ALIVE=False
    PLAYER=pygame.image.load("ball.gif")
    ENEMY=pygame.image.load("ship.gif")
    
    [...]
    Can you post your entire code? Otherwise it's impossible to debug.

    Anyhow, this is how you draw an image (from http://rene.f0o.com/mywiki/LectureThree):

    Code:
    pygame.init() 
    window = pygame.display.set_mode((468, 60))
    screen = pygame.display.get_surface()
    file_name = '/some/image/somewhere'
    surface = pygame.image.load(file_name)
    screen.blit(surface, (0,0)) 
    pygame.display.flip()

IMN logo majestic logo threadwatch logo seochat tools logo