screen.blit function not working in pygame

Viewed 91
import pygame, sys

WINDOW_SIZE = (900, 700)
screen = pygame.display.set_mode(WINDOW_SIZE, 0, 32)
pygame.display.set_caption('Pygame Program')
pygame.display.set_icon(pygame.image.load('spaceship (3).png'))

player_img = pygame.image.load('ClipartKey_738895_adobespark.png')
player_X = 130
player_Y = 750
def player():
    screen.blit(player_img, (player_X, player_Y))

running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
            sys.exit()
    screen.fill((0, 200, 255))
    player()
    pygame.display.update()

My player() function doesn't work. It doesn't show any error but the screen remains blank and nothing is shown on it

1 Answers

The coordinate (130, 750) is at the bottom outside of the window. Change the y-coordinate. e.g:

player_Y = 750

player_Y = 150
Related