Exemplo n.º 1
0
    def attack(self):
        wielder = self.get_wielder()

        e = entity.get_entity_type("Projectile")()

        e.controlled_by = wielder.controlled_by
        e.position = wielder.position.copy()
        e.duration = self.proj_life
        e.rotation = wielder.rotation
        e.move_dir = euclid.Vector2(*util.rot_to_vec(e.rotation))
        game.spawn(e)
        
        if game.is_controlled(e):
            events.dispatch("on_attack", self.get_wielder(), self, e)
Exemplo n.º 2
0
    def attack(self):
        real_wielder = self.get_wielder()

        e = entity.get_entity_type("Projectile")()

        e.damage = 20
        e.friendly = real_wielder.friendly
        e.controlled_by = real_wielder.controlled_by
        e.position = real_wielder.position.copy()
        e.duration = self.proj_life
        e.rotation = real_wielder.rotation
        e.move_dir = util.rot_to_vec(e.rotation)

        game.Game.spawn(e)

        #e.body.linearVelocity = util.rot_to_vec(e.rotation) * self.proj_speed  # TODO: This should be set in the projectille itself (currently cant because of physics body being created after the instance)

        if game.Game.is_controlled(e):
            events.dispatch("on_attack", self.get_wielder(), self, e)
Exemplo n.º 3
0
 def update_collision(self):
     center = Vector2(*self.position) + util.rot_to_vec(self.rotation) * self.offset
     #print center, self.size
     return cm.CircleShape(center=center, r=self.size)