0

If it helps, I can notify that I have saved my file in the same directory as the images. Also, the code gives the following error:

Traceback (most recent call last):
  File "/home/pi/platform/platformer.py", line 11, in <module>
    sun_img = pygame.image.load('home/pi/platform/sun.png')
pygame.error: Couldn't open home/pi/platform/sun.png

This is the code that I have written:

import pygame
from pygame.locals import *

pygame.init()

screen_width = 1000
screen_height = 1000
tile_size = 200

screen = pygame.display.set_mode((screen_width, screen_height))
sun_img = pygame.image.load('home/pi/platform/sun.png')
bg_img = pygame.image.load('home/pi/platform/background.jpg')

run = True
while run:
    
    screen.blit(bg_img, (0, 0))
    screen.blit(sun_img, (100, 100))
    
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False


    pygame.display.update()

0 Answers0