Answer the question
In order to leave comments, you need to log in
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
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question