When I run this code, the window opens, and i can click on the X button and it quits normally, but my image doesn't show up, heres my code:
import pygame
class Player:
def __init__(self, speed, image):
self.move_speed = speed
self.x = 0
self.y = 0
self.speed = [0,0]
self.image = pygame.image.load(image)
def update(self):
self.x = self.speed[0]
self.y = self.speed[1]
def walk_left(self):
self.speed[0] -= self.move_speed
def walk_right(self):
self.speed[0] += self.move_speed
def walk_up(self):
self.speed[1] += self.move_speed
def walk_down(self):
self.speed[1] += self.move_speed
def main():
p = Player(2, "rifleman_blu.png")
screen = pygame.display.set_mode((640,480))
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
return
if event.type == pygame.K_LEFT:
p.walk_left()
if event.type == pygame.K_RIGHT:
p.walk_right()
screen.blit(p.image, (p.x, p.y))
if __name__ == '__main__': main()
Any help would be appreciated :)