pygame 忘记了图像是什么

问题描述

我正在尝试在窗口上绘制一个小图像。 问题是,当我运行代码时,会弹出这个。

    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

解决方法

我认为应该是 pygame.image.load 而不是 screen.image.load

Pygame Image reference