-1

I am trying to draw a little image onto the window. problem is, when I run the code, this pops up.

    AttributeError: 'pygame.Surface' object has no attribute 'image'
    
    anyway here the code.
    
    import pygame, sys, os, math

    pygame.init()
    runing_left = False
    runing_right = False
    screen_Width_heigth = (1920, 1020)

    screen = pygame.display.set_mode((screen_Width_heigth))
    player_sur = screen.image.load('asset/Josh.png').convert()
    player = player_sur.get_rect(center = (17, 22))
    pygame.display.set_caption('platformer: torch guy')
    game_state = [True]
    and a bunch of code that isn't gotta help you to help me
pawnadona
  • 21
  • 3
  • Pygame did not forget what an image is. Screen simply doesn't have an attribute called image. Going through the [docs](https://www.pygame.org/docs/) might help. If your confident that your code is correct, try updating pygame. – mcdonalds291 May 16 '21 at 04:31
  • that a metaphor for the fact I don't know how to fix it – pawnadona May 16 '21 at 05:06
  • You probably should have said so.. That "metaphor" is extremely unclear. – mcdonalds291 May 16 '21 at 05:20
  • As mentioned in the answer you have to use [`pygame.image.load`](https://www.pygame.org/docs/ref/image.html) – Rabbid76 May 16 '21 at 06:59

1 Answers1

1

I think that should be pygame.image.load instead of screen.image.load.

Pygame Image reference.

Nathan Mills
  • 2,243
  • 2
  • 9
  • 15