F
F
FoorA2021-03-08 00:57:45
pygame
FoorA, 2021-03-08 00:57:45

I can't upload a file in pygame, it gives me an error how do I upload a photo?

import pygame

pygame.init() #screen

width
= 500
height = 500
display = pygame.display.set_mode((width, height))
pygame.display.set_caption("something")

x = 50
y = 425
width = 40
height = 60
speed = 5
#jump
Jump = False
Jumpspeed = 10
#animation
animleft = pygame.image.load('per1.png')

left = False
right = False
anim = 0 #main

loop
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() #boundary
conditions control
if keys[pygame.K_LEFT] and x > 5:
x -= speed
if keys[pygame.K_RIGHT] and x < 500 - width - 5:
x += speed
if not(Jump): #if jump then:
if keys[pygame.K_SPACE]:
Jump = True
else:
if Jumpspeed >= -10:
y -= Jumpspeed * 2
Jumpspeed -= 1

else:
Jump = False
Jumpspeed = 10



#clear screen
display.fill((0,0,0))

pygame.draw.rect(display, (0,0,225), (x, y, width, height ))
pygame.display.update()

pygame.quit()
60454b5db1e07215962423.png
is the error itself the
60454c09dc545402772486.png
file with the code and the picture is in the same file
PLEASE HELP

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question