move the metho shoot from Object to Player

This commit is contained in:
kleph 2009-08-15 02:33:14 +02:00
parent 56ed20a985
commit 272b60de5b

View file

@ -65,10 +65,6 @@ class Object(pygame.sprite.Sprite):
# self.rect = self.rect.move(self.dx, self.dy) # self.rect = self.rect.move(self.dx, self.dy)
self.rect.move_ip(self.speed) self.rect.move_ip(self.speed)
def shoot(self):
""" create a bullet and add it to the global bullet list"""
bullet = globals.bulletfactory.create(0, self.rect.midright)
globals.bullets_list.add(bullet)
class BulletFactory(): class BulletFactory():
@ -98,6 +94,10 @@ class Player(Object):
def __init__(self, frames, pos, speed): def __init__(self, frames, pos, speed):
Object.__init__(self, frames, pos, speed) Object.__init__(self, frames, pos, speed)
def shoot(self):
""" create a bullet and add it to the global bullet list"""
bullet = globals.bulletfactory.create(0, self.rect.midright)
globals.bullets_list.add(bullet)
def init_gfx(): def init_gfx():
"""graphics initialisation""" """graphics initialisation"""