Crossin的编程教室
标题:
求助
[打印本页]
作者:
maoguangyi
时间:
2013-9-18 20:59
标题:
求助
想把打飞机那个游戏用sprite类写,但写不好
求教这个类改得对不对
class Bullet(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load('bullet.png').convert_alpha()
self.rect = self.image.get_rect()
self.rect.center = (0, -1)
self.active = False
def move(self):
if self.active:
self.rect.top -= 0.8
if self.rect.top < 0:
self.active = False
def restart(self):
pos = pygame.mouse.get_pos()
self.rect.center = pos
self.active = True
欢迎光临 Crossin的编程教室 (https://bbs.crossincode.com/)
Powered by Discuz! X2.5