我做了这个,您可能会感兴趣:
import pygame, sysfrom pygame.locals import *SCREEN_X=400SCREEN_Y=400#Screen sizeSPRT_RECT_X=0 SPRT_RECT_Y=0#This is where the sprite is found on the sheetLEN_SPRT_X=100LEN_SPRT_Y=100#This is the length of the spritescreen = pygame.display.set_mode((SCREEN_X, SCREEN_Y)) #Create the screensheet = pygame.image.load('C:YOURFILE') #Load the sheetsheet.set_clip(pygame.Rect(SPRT_RECT_X, SPRT_RECT_Y, LEN_SPRT_X, LEN_SPRT_Y)) #Locate the sprite you wantdraw_me = sheet.subsurface(sheet.get_clip()) #Extract the sprite you wantbackdrop = pygame.Rect(0, 0, SCREEN_X, SCREEN_Y) #Create the whole screen so you can draw on itscreen.blit(draw_me,backdrop) #'Blit' on the backdroppygame.display.flip()#Draw the sprite on the screen希望我能帮上忙



