コード例 #1
0
    def ulti(self):
        # shots 5 bullets simultaneously
        bullet_1 = Bullet(self)
        bullet_2 = Bullet(self)
        bullet_3 = Bullet(self)
        bullet_4 = Bullet(self)
        bullet_5 = Bullet(self)

        bullet_1.set_damage(30)
        bullet_2.set_damage(30)
        bullet_3.set_damage(30)
        bullet_4.set_damage(30)
        bullet_5.set_damage(30)

        bullet_1.setPos(self.x() + 25, self.y() + 25)
        bullet_2.setPos(self.x() + 25, self.y() + 25)
        bullet_3.setPos(self.x() + 25, self.y() + 25)
        bullet_4.setPos(self.x() + 25, self.y() + 25)
        bullet_5.setPos(self.x() + 25, self.y() + 25)

        bullet_1.setRotation(self.rotation() - 90)
        bullet_2.setRotation(self.rotation() - 90 + 10)
        bullet_3.setRotation(self.rotation() - 90 - 10)
        bullet_4.setRotation(self.rotation() - 90 + 20)
        bullet_5.setRotation(self.rotation() - 90 - 20)

        self.scene().addItem(bullet_1)
        self.scene().addItem(bullet_2)
        self.scene().addItem(bullet_3)
        self.scene().addItem(bullet_4)
        self.scene().addItem(bullet_5)

        self.ulti_available = False
        self.ulti_cooldown_timer.start(self.cooldown)
コード例 #2
0
ファイル: Tower.py プロジェクト: lechodiman/iic2233-2017-1
    def fire(self):
        if not self.scene():
            return
        bullet = Bullet(self)
        bullet.setPos(self.x() + 40, self.y() + 40)

        # set the angle to be paralel to the line that connects the
        # tower and target
        ln = QLineF(QPointF(self.x() + 40, self.y() + 40), self.attack_dest)
        angle = -1 * ln.angle()  # -1 to make it clock wise

        bullet.setRotation(angle)
        self.scene().addItem(bullet)