简体   繁体   中英

Pygame does not show anything

i'am trying to make a game but pygame does not show my player. I think pygame has a bug butt maybe is it is a coding mistake please review.

import pygame

pygame.init()

Running = True

Current_Color=pygame.Color("LIGHTBLUE")

Mouse_x,Mouse_y = pygame.mouse.get_pos()

Player_image = pygame.image.load("550x804.jpg")

screen = pygame.display.set_mode([1300, 720])

screen.fill(pygame.Color("LIGHTBLUE"))

while Running == True:
    screen.fill(pygame.Color("LIGHTBLUE"))
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            Running = False
    screen.blit(Player_image ,(100,100))
    Player_image = pygame.transform.scale(Player_image, (10,20))

you have just to add pygame.display.update() in the while loop:

import pygame
pygame.init()
Running = True

Current_Color=pygame.Color("LIGHTBLUE")

Mouse_x,Mouse_y = pygame.mouse.get_pos()    
Player_image = pygame.image.load("550x804.jpg")

screen = pygame.display.set_mode([1300, 720])
screen.fill(pygame.Color("LIGHTBLUE"))

while Running == True:
    screen.fill(pygame.Color("LIGHTBLUE"))
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            Running = False
    screen.blit(Player_image ,(100,100))
    Player_image = pygame.transform.scale(Player_image, (10,20))
    pygame.display.update()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM