示例#1
0
    def destroy(self, position=None):
        if not position: position = self.position

        animation = explosionStandartBulletAnimation(self.position, self.rotation)
        get_main_layer().dispatch_event('add_animation', animation)

        super(StandartBullet, self).destroy()
示例#2
0
 def on_animation_end(self):
     # Global.Layers.removeAnimation(self)
     try:
         get_main_layer().dispatch_event('remove_animation', self)
         self.delete()
     except Exception as e:
         print('Exception', e)
         print(self, self.position)
示例#3
0
    def fire(self, bullet=None):
        position = self.firePosition()
        rotation = self.fireRotation()
        animatiom_position = self.fireAnimationPosition()
        animatiom_rotation = self.tank.getGunRotation()

        bullet = StandartBullet(position, rotation, fired_tank=self.tank)
        get_main_layer().dispatch_event('add_bullet', bullet)

        animation = StandartBulletFireAnimation(animatiom_position,
                                                animatiom_rotation)
        get_main_layer().dispatch_event('add_animation', animation)
示例#4
0
    def checkDamageCollisions(self):
        main_scene = get_main_layer()

        for tank in main_scene.tanksLayer.get_children():
            tank.cshape = cm.AARectShape(tank.position, tank.width // 2,
                                         tank.height // 2)

        damage_collisions = Global.CollisionManager.objs_colliding(self)

        if damage_collisions:
            # for damage_wall in main_scene.objectsLayer.get_children():
            #     if damage_wall.type == 'destroyable':
            #         if damage_wall in damage_collisions:
            #             damage_wall.damage(self.bullet)

            for player in main_scene.tanksLayer.get_children():
                if player in damage_collisions:
                    dmg = player.damage(self.bullet)
示例#5
0
 def destroy(self, position=None):
     main = get_main_layer()
     main.bulletsLayer.remove(self)
     CollisionManager.remove_tricky(self)
示例#6
0
 def get_observation(self):
     return get_main_layer().get_observation(self.target)