def shoot_player(self, x): from engine.game_object import GameObject bullet = GameObject() bullet.name = "EnemyBullet" + str(self.bullet_counter) bullet.get_behaviour("Transform").position.x = x bullet.get_behaviour("Transform").position.y = 200 bullet.add_behaviour(EnemyBulletMovement()) bullet.add_behaviour(BulletRenderer()) bullet.get_behaviour("BulletRenderer").do_rotate(180) GameObject.add_to_screen(bullet) self.bullet_counter += 1
def shoot(self): self.has_shot = True from engine.game_object import GameObject bullet = GameObject() bullet.name = "Bullet" + str(self.bullet_counter) tr = self.game_object.get_behaviour("Transform") bullet.get_behaviour("Transform").position.x = tr.position.x - 12 bullet.get_behaviour("Transform").position.y = tr.position.y - 54 bullet.get_behaviour("Transform").rotation = tr.rotation bullet.add_behaviour(BulletMovement()) bullet.add_behaviour(BulletRenderer()) GameObject.add_to_screen(bullet) self.bullet_counter += 1
def shoot(self): self.has_shot = True from engine.game_object import GameObject bullet = GameObject() bullet.name = "Bullet" + str(self.bullet_counter) bullet.get_behaviour( "Transform").position.x = self.game_object.get_behaviour( "Transform").position.x bullet.get_behaviour( "Transform").position.y = self.game_object.get_behaviour( "Transform").position.y bullet.get_behaviour( "Transform").rotation = self.game_object.get_behaviour( "Transform").rotation bullet.add_behaviour(BulletMovement()) bullet.add_behaviour(BoxCollider()) bullet.get_behaviour("BoxCollider").is_debug = True bullet.get_behaviour("BoxCollider").extent = pygame.math.Vector2(10) bullet.add_behaviour(BulletRenderer()) GameObject.add_to_screen(bullet) self.bullet_counter += 1