1

I have tried to load custom sprites I have made and nothing is working! My error is:

Traceback (most recent call last):

  File "C:\Users\BenPa\AppData\Local\Programs\Python\Python38-32\Testing pygame.py", line 5, in <module>
    WalkRight = pygame.image.load("./Python38/RPGsprites/RPGsprite_1.png")
pygame.error: Couldn't open ./Python38/RPGsprites/RPGsprite_1.png

My code is:

import pygame

pygame.init()

win = pygame.display.set_mode((1000,800))

pygame.display.set_caption("A RPG Game")

WalkRight = pygame.image.load("./Python38/RPGsprites/RPGsprite_1.png")

WalkLeft = pygame.image.load("./C:/Python38/RPGsprites/RPGsprite_4.png")

WalkIdle = pygame.image.load("./C:/Python38/RPGsprites/RPGsprite_0.png")

Background = pygame.image.load("./C:/Python38/RPGsprites/BackGround.png")

Please help!

Αntonis Papadakis
  • 1,210
  • 1
  • 12
  • 22
Ben Paton
  • 11
  • 1

1 Answers1

0

A problem is your path, it should be WalkRight = pygame.image.load("C:/Python38/RPGsprites/RPGsprite_1.png") and i think you should use python 3.7 or lower to make sure compatible with pygame.

Tài Hồ
  • 41
  • 7