Exemplo n.º 1
0
    def init(self, actor: stdbomb.Bomb, position, velocity, materials):
        factory = stdbomb.BombFactory.get()
        actor.node = ba.newnode('prop',
                                delegate=actor,
                                attrs={
                                    'position': position,
                                    'velocity': velocity,
                                    'body': 'sphere',
                                    'materials': materials
                                })

        actor.first_shield = ba.newnode(
            'shield', owner=actor.node, attrs={
                'color': (1, 1, 1),
                'radius': 0.6})

        actor.node.connectattr(
            'position', actor.first_shield, 'position')

        actor.second_shield = ba.newnode(
            'shield', owner=actor.node, attrs={
                'color': (20, 0, 0),
                'radius': 0.4})

        actor.node.connectattr(
            'position', actor.second_shield, 'position')

        ba.animate(actor.second_shield, 'radius',
                   {0: 0.1, 0.05: 0.4, 0.2: 0.1, 0.25: 0.5, 0.4: 0.3, 0.7: 0.1}, True)
Exemplo n.º 2
0
    def init(self, actor: stdbomb.Bomb, position, velocity, materials):
        factory = stdbomb.BombFactory.get()
        actor.node = ba.newnode('prop',
                                delegate=actor,
                                attrs={
                                    'body': 'sphere',
                                    'body_scale': 0.85,
                                    'position': position,
                                    'velocity': velocity,
                                    'materials': materials
                                })

        actor.first_shield = ba.newnode('shield',
                                        owner=actor.node,
                                        attrs={
                                            'color': (1, 1, 1),
                                            'radius': 0.6
                                        })

        actor.node.connectattr('position', actor.first_shield, 'position')

        actor.second_shield = ba.newnode('shield',
                                         owner=actor.node,
                                         attrs={
                                             'color': (0, 0, 20),
                                             'radius': 0.4
                                         })

        actor.node.connectattr('position', actor.second_shield, 'position')

        color = {
            0: (1, 1, 1),
            1: (20, 0, 0),
            2: (20, 10, 0),
            3: (20, 20, 0),
            4: (0, 20, 0),
            5: (0, 10, 20),
            6: (0, 0, 20),
            7: (10, 0, 20),
            8: (1, 1, 1)
        }

        ba.animate_array(actor.second_shield, 'color', 3, color, True)