From 77f6ca9a749c7909e6d27b3380a473106cf2e30f Mon Sep 17 00:00:00 2001 From: kleph Date: Mon, 17 Aug 2009 23:53:40 +0200 Subject: [PATCH] added bullet_type to player class --- pyshoot.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pyshoot.py b/pyshoot.py index 25b7570..2b138fe 100755 --- a/pyshoot.py +++ b/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):