From 1045707f7236c79217136596d54419eeff5f013b Mon Sep 17 00:00:00 2001 From: kleph Date: Tue, 23 Feb 2010 00:54:01 +0100 Subject: [PATCH] added window name and hidden mouse --- pyshoot.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pyshoot.py b/pyshoot.py index 1df0e72..7c88945 100755 --- a/pyshoot.py +++ b/pyshoot.py @@ -107,10 +107,20 @@ class BulletFactory(): """ create a bullet of type 2 temporary ennemies bullet """ - bullet = Bullet(['bullet.bmp'], 0, pos) + bullet = Bullet(['bullet_red.bmp'], 0, pos) bullet.speed = speed bullet.damage = 10 return bullet + + def create_type3(self, pos, speed): + """ create a bullet of type 3 + temporary ennemies bullet (aiming) """ + + bullet = Bullet(['bullet_purple.bmp'], 0, pos) + bullet.speed = speed + bullet.damage = 10 + return bullet + class Bullet(Object): def __init__(self, frames, type, pos): @@ -231,7 +241,7 @@ class Enemy(Object): def shoot_player(self): """ shoot a bullet to the player """ - speed = self.aim_player() + speed = self.aim() bullet = globals.bullet_factory.create_type2(self.rect.midleft, speed) globals.bullets_list.add(bullet) @@ -239,6 +249,11 @@ class Enemy(Object): """ compute speed vector to aim at current player position """ # get player position player_pos = globals.player.rect + direction = (player_pos[0] - self.rect[0], player_pos[1] - self.rect[1]) + # norm = + + def aim(self): + """ set bullet speed """ return (-10, 0) @@ -265,6 +280,8 @@ def init_sound(): def init(): """ general initialisation""" pygame.init() + pygame.display.set_caption('Pyshoot') + pygame.mouse.set_visible(0) init_gfx() globals.clock = pygame.time.Clock() random.seed()