0
我想用Pygame和Python 3.4创建一个小游戏。 我一直在试图创建一个角色精灵,但即使有大量的在线教程,我也没有设法让我的代码正常工作。我知道窗户本身加载的很好,但我不知道为什么我会出现错误。pygame雪碧没有属性绘制
这里是我的代码:
import pygame, sys, os
from pygame.locals import *
class player(pygame.sprite.Sprite):
def __init__(self,img):
pygame.sprite.Sprite.__init__(self)
self.image = img
self.rect = self.image.get_rect()
pygame.init()
DISPLAYSURF = pygame.display.set_mode((1000,750))
pygame.display.set_caption('Hello world')
img = pygame.image.load("pixel art\RPGchar.png").convert_alpha()
while True: #game loop
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
player.draw(DISPLAYSURF)
player.update()
pygame.display.flip()
任何帮助将让我非常感激。 tnx
非常感谢这是非常有用的 – user3946189 2014-11-21 23:22:35