Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
More pygame errors
#1
Attempting to help my son.
I cannot find the error or a reason

Extract
import png, os, pygame
pygame.init()

win = pygame.display.set_mode((1200,900))

pygame.display.set_caption("First Game")

WalkRight = pygame.image.load(os.path.join('Red_Knight_Right.png'))
WalkLeft = pygame.image.load(os.path.join('Red_Knight_left.png'))
bg = pygame.image.load(os.path.join('game background.png'))
char = pygame.image.load(os.path.join('Red Knight.png'))
Stab_left = pygame.image.load(os.path.join('Red_Knight_stab_Left.png'))

x = 500
y = 410
#varibles 
width = 40
height = 60
vel = 10
isJump = False
jumpcount = 10
left = False
right = False
Stab_left = False


def redrawGameWindow():
    
    win.blit(bg, (0,0))
    
  
    if left:
            win.blit(WalkLeft, (x,y))
            
    elif right:
            win.blit(WalkRight, (x,y))

    elif Stableft:
        win.blit(Stab_left)
 
Error:
pygame 1.9.4 Hello from the pygame community. https://www.pygame.org/contribute.html Traceback (most recent call last): File "C:\Users\******\Downloads\python_game_resourses\knight_game_combat_testing_not.py", line 8, in <module> WalkRight = pygame.image.load(os.path.join('Red_Knight_Right.png')) pygame.error: Couldn't open Red_Knight_Right.png
the image files are located in the same directory as the py file (C:\Users\******\Downloads\python_game_resourses\knight_game_combat_testing_not.py)
I have also attempted the code as follow:

WalkRight = pygame.image.load('Red_Knight_Right.png')
WalkLeft = pygame.image.load('Red_Knight_left.png')
bg = pygame.image.load('game background.png')
char = pygame.image.load('Red Knight.png')
Stab_left = pygame.image.load('Red_Knight_stab_Left')

Same result

I also attempted with .convert()


Why is it not picking it up ?

I have read the previous post on this topic and attempted all suggestions. Wall
Reply


Messages In This Thread
More pygame errors - by PyEH - Jan-02-2019, 07:59 PM
RE: More pygame errors - by metulburr - Jan-02-2019, 08:14 PM
RE: More pygame errors - by PyEH - Jan-02-2019, 08:14 PM
RE: More pygame errors - by metulburr - Jan-02-2019, 08:23 PM
RE: More pygame errors - by PyEH - Jan-02-2019, 08:38 PM
RE: More pygame errors - by metulburr - Jan-02-2019, 08:57 PM
RE: More pygame errors - by metulburr - Jan-02-2019, 09:03 PM
RE: More pygame errors - by PyEH - Jan-02-2019, 09:09 PM
RE: More pygame errors - by metulburr - Jan-02-2019, 09:19 PM
RE: More pygame errors - by PyEH - Jan-02-2019, 09:33 PM
RE: More pygame errors - by metulburr - Jan-02-2019, 10:16 PM
RE: More pygame errors - by PyEH - Jan-03-2019, 08:09 AM
RE: More pygame errors - by metulburr - Jan-03-2019, 05:12 PM
RE: More pygame errors - by PyEH - Jan-03-2019, 10:57 PM
RE: More pygame errors - by Mekire - Jan-05-2019, 06:23 AM
RE: More pygame errors - by PyEH - Jan-06-2019, 10:16 AM
RE: More pygame errors - by metulburr - Jan-06-2019, 02:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pygame*import pygame ImportError: No module named pygame CASPERHANISCH 1 9,763 Jun-05-2017, 09:50 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020