Merge branch 'second_shot'
This commit is contained in:
commit
2d829bf19c
1 changed files with 10 additions and 1 deletions
11
pyshoot.py
11
pyshoot.py
|
@ -72,6 +72,14 @@ class BulletFactory():
|
||||||
bullet.damage = 10
|
bullet.damage = 10
|
||||||
return bullet
|
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):
|
class Bullet(Object):
|
||||||
def __init__(self, frames, type, pos):
|
def __init__(self, frames, type, pos):
|
||||||
|
@ -96,10 +104,11 @@ 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)
|
||||||
self.shooting = False
|
self.shooting = False
|
||||||
|
self.bullet_type = 0
|
||||||
|
|
||||||
def shoot(self):
|
def shoot(self):
|
||||||
""" create a bullet and add it to the global bullet list"""
|
""" 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)
|
globals.bullets_list.add(bullet)
|
||||||
|
|
||||||
def start_move(self, vector):
|
def start_move(self, vector):
|
||||||
|
|
Loading…
Reference in a new issue