added bullet_type to player class
This commit is contained in:
parent
7e8a2c7e7b
commit
77f6ca9a74
1 changed files with 10 additions and 1 deletions
11
pyshoot.py
11
pyshoot.py
|
@ -72,6 +72,14 @@ class BulletFactory():
|
|||
bullet.damage = 10
|
||||
return bullet
|
||||
|
||||
def create_type1(self, pos):
|
||||
""" create a bullet of type 1
|
||||
temporary laser type """
|
||||
|
||||
bullet = Bullet(['laser1.bmp', 'laser2.bmp', 'laser3.bmp'], 0, pos)
|
||||
bullet.speed = (10,0)
|
||||
bullet.damage = 10
|
||||
return bullet
|
||||
|
||||
class Bullet(Object):
|
||||
def __init__(self, frames, type, pos):
|
||||
|
@ -96,10 +104,11 @@ class Player(Object):
|
|||
def __init__(self, frames, pos, speed):
|
||||
Object.__init__(self, frames, pos, speed)
|
||||
self.shooting = False
|
||||
self.bullet_type = 0
|
||||
|
||||
def shoot(self):
|
||||
""" create a bullet and add it to the global bullet list"""
|
||||
bullet = globals.bulletfactory.create(0, self.rect.midright)
|
||||
bullet = globals.bulletfactory.create(self.bullet_type, self.rect.midright)
|
||||
globals.bullets_list.add(bullet)
|
||||
|
||||
def start_move(self, vector):
|
||||
|
|
Loading…
Reference in a new issue