move the metho shoot from Object to Player
This commit is contained in:
parent
56ed20a985
commit
272b60de5b
1 changed files with 4 additions and 4 deletions
|
@ -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"""
|
||||||
|
|
Loading…
Reference in a new issue