L
L
leon -----2021-03-21 10:55:04
Python
leon -----, 2021-03-21 10:55:04

Can't open file 'd:\╨░╨┐╨║╨╕ ╨╗╨╡╨╛\Python\Python fiels\pygame1.py': [Errno 2] No such file or directory. How to decide?

I want to load a character into the game but I can't get an error: Can't open file 'd:\╨░╨┐╨║╨╕ ╨╗╨╡╨╛\Python\Python fiels\pygame1.py': [Errno 2] No such file or directory

import pygame

pygame.init()
win = pygame.display.set_mode((500, 500))
pygame.display.set_caption("GAME one")

walkRight = [pygame.image.load('R1.png'), pygame.image.load('R2.png'), pygame.image.load('R3.png'), pygame.image.load('R4.png'), pygame.image.load('R5.png'), pygame.image.load('R6.png'), pygame.image.load('R7.png'), pygame.image.load('R8.png'), pygame.image.load('R9.png')]
walkLeft = [pygame.image.load('L1.png'), pygame.image.load('L2.png'), pygame.image.load('L3.png'), pygame.image.load('L4.png'), pygame.image.load('L5.png'), pygame.image.load('L6.png'), pygame.image.load('L7.png'), pygame.image.load('L8.png'), pygame.image.load('L9.png')]
bg = pygame.image.load('bg.jpg')
char = pygame.image.load('standing.png')

x = 50
y = 425
width = 40 
height = 60
speed = 5

isJump = False
jumpCount = 10

left = False
right = False
animCount = 0


run = True
while run:
    pygame.time.delay(50)

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False

    keys = pygame.key.get_pressed()
    if keys[pygame.K_LEFT] and x > 5:
        x -= speed
    if keys[pygame.K_RIGHT] and x < 500 - width - 5:
        x += speed
    if not(isJump):
        if keys[pygame.K_SPACE]:
            isJump = True
    else:
        if jumpCount >= -10:
            if jumpCount < 0:
                y += (jumpCount ** 2) / 2
            else:
                y -= (jumpCount ** 2) / 2
            jumpCount -= 1
        else:
            isJump = False
            jumpCount =10

    win.fill((0,0,0))
    pygame.draw.rect(win, (0,0,255), (x, y, width, height))
    pygame.display.update()
pygame.quit()

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Armenian Radio, 2021-03-21
@gbg

Get Russian letters out of the way

A
Anvar Shakhmaev, 2021-03-21
@RxR

You have unsupported characters in your path.

S
Sergey Ryzhkin, 2021-03-21
@Franciz

As a "novice programmer" (no matter what) you should learn one simple truth: "Forget the Cyrillic alphabet like a bad dream" and stop using it. Most of the most obvious problems and frequent bugs will be solved by themselves.

S
Saboteur, 2021-03-21
@saboteur_kiev

python fiels

is there really no error here?
Well, in general, you need to look at the place where you call the file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question