PyGame "blit" not working, but there is no error message

117 Views Asked by At

For some reason, the PyGame blit command is not working for me. Whenever I run my code, nothing appears on screen, but there is no error message in the console.

import pygame

pygame.init()
screen = pygame.display.set_mode((1920, 1080))
clock = pygame.time.Clock()

def loadImages():
    global ground
    ground = pygame.image.load("assets/ground/tile.png")

loadImages()

# Game Loop
while True: 
    screen.blit(ground, (0, 0))
    pygame.display.update()
    clock.tick(30)
1

There are 1 best solutions below

1
Phenomenal Physics On
import pygame,sys

pygame.init()
screen = pygame.display.set_mode((1920, 1080))
clock = pygame.time.Clock()

def loadImages():
    global ground
    ground = pygame.image.load("assets/ground/tile.png").convert_alpha()

loadImages()

# Game Loop
while True: 
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
    screen.blit(ground, (0, 0))
    pygame.display.update()
    clock.tick(30)

Try this