The basic format would be along the lines of such a class as the following. As yuu have it now you are just drawing a rect. Load an image and blit it to the players location at its assigned rect. Download this repo and playtest for examples. Check out the moving platforms one for side scroller platforms example.
class Player: def __init__(self, screen_rect): self.image = pygame.image.load('image.png').convert() self.rect = self.image.get_rect(center=screen_rect.center) def get_event(self, event): if event.type == pygame.KEYDOWN: if event.key == pygame.K_LEFT: self.rect.x -= self.speed elif event.key == pygame.K_RIGHT: self.rect.x += self.speed def draw(self, surf): surf.blit(self.image, self.rect)
Recommended Tutorials: