def getInstance(bullet):
        new_bullet = None

        if bullet.get('typeClass') == 'StandartBullet':
            new_bullet = StandartBullet()

        new_bullet.position = bullet.get('position')
        new_bullet.id = bullet.get('id')
        return new_bullet
Ejemplo n.º 2
0
    def fire(self):
        if self.canFire:
            self.canFire = False

            x, y = self.Gun.position

            bullet = StandartBullet()
            bullet.update_rotation(self.Gun.rotation)
            bullet.update_position(x, y)

            settings.objects['bullets'].append(bullet)
            settings.layers['bullets'].add(bullet)

            t = Timer(self.bulletFreezTime, self.acceptFire)
            t.start()
Ejemplo n.º 3
0
    def fire(self):
        if self.canFire:
            self.canFire = False

            x, y = self.Gun.position

            bullet = StandartBullet()
            bullet.update_rotation(self.Gun.rotation)
            bullet.update_position(x, y)

            settings.TankNetworkListenerConnection.Send({
                'action': settings.Actions.TANK_FIRE,
                'type': 'StandartBullet',
                'pos': bullet.position,
                'rotation': bullet.rotation,
                'id': self.id
            })

            #settings.objects['bullets'].append(bullet)
            #settings.layers['bullets'].add(bullet)

            t = Timer(self.bulletFreezTime, self.acceptFire)
            t.start()