added bullet_type to player class

This commit is contained in:
kleph 2009-08-17 23:53:40 +02:00
parent 7e8a2c7e7b
commit 77f6ca9a74

View file

@ -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):