Jump to content
  • Advertisement
Sign in to follow this  

[pygame] white screen won't initialize

This topic is 4409 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm rewriting some code in pygame and for some reason, after initializing everything (or so it seems), screen.fill(white) (with white set to 255, 255, 255 RBG colors) won't set the screen to white. Code:
import pygame, sys,os
from pygame.locals import *

def initialize():
    window = pygame.display.set_mode((800,500)) #setup screen size
    #where images can be held
    pygame.display.set_caption("Sprite walking")
screen = pygame.display.get_surface() # set area in memory
white = 255, 255, 255
sprite_names = [os.path.join("pics", s) for s in ["guy.bmp", "walkone.bmp", "walktwo.bmp"]]
sprites = [pygame.image.load(s) for s in sprite_names]
running = True
time = 0
spritenumber = 0
x = 0
pygame.display.flip #update display
while running == True:
    for event in pygame.event.get():
        if event.type == QUIT:
                running = False

    ctime = pygame.time.get_ticks()
    if ctime - time > 500:
        x = x + 10
        time = ctime
        spritenumber = (spritenumber + 1) % 3
        screen.blit(sprites[spritenumber], (x, 100))


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!