コード例 #1
0
ファイル: heal.py プロジェクト: egorkAh/BombDash-server
    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)
コード例 #2
0
ファイル: stickygift.py プロジェクト: egorkAh/BombDash-server
    def handlemessage(self, actor: stdbomb.Bomb, msg: Any) -> bool:
        if isinstance(msg, ba.PickedUpMessage):
            if actor.node and actor.owner != msg.node:
                ba.playsound(ba.getsound("corkPop"),
                             position=actor.node.position)

                actor.explode()
                return True
        elif isinstance(msg, SetStickyMessage):
            node = ba.getcollision().opposingnode
            self.on_sticky_gift(actor, node)
            return True
        return False
コード例 #3
0
ファイル: elonmine.py プロジェクト: egorkAh/BombDash-server
 def init(self, actor: stdbomb.Bomb, position: Sequence[Union[int, float]],
          velocity: Sequence[Union[int, float]],
          materials: Sequence[ba.Material]):
     factory = stdbomb.BombFactory.get()
     actor.node = ba.newnode('prop',
                             delegate=actor,
                             attrs={
                                 'body':
                                 'landMine',
                                 'model':
                                 factory.land_mine_model,
                                 'light_model':
                                 factory.land_mine_model,
                                 'color_texture':
                                 ba.gettexture('achievementCrossHair'),
                                 'position':
                                 position,
                                 'velocity':
                                 velocity,
                                 'shadow_size':
                                 0.44,
                                 'reflection':
                                 'powerup',
                                 'reflection_scale': [1],
                                 'materials':
                                 materials
                             })
コード例 #4
0
ファイル: easteregghunt.py プロジェクト: snow-1711/ballistica
    def _update(self) -> None:
        # Misc. periodic updating.
        xpos = random.uniform(-7.1, 6.0)
        ypos = random.uniform(3.5, 3.5)
        zpos = random.uniform(-8.2, 3.7)

        # Prune dead eggs from our list.
        self._eggs = [e for e in self._eggs if e]

        # Spawn more eggs if we've got space.
        if len(self._eggs) < int(self._max_eggs):

            # Occasionally spawn a land-mine in addition.
            if self._pro_mode and random.random() < 0.25:
                mine = Bomb(position=(xpos, ypos, zpos),
                            bomb_type='land_mine').autoretain()
                mine.arm()
            else:
                self._eggs.append(Egg(position=(xpos, ypos, zpos)))
コード例 #5
0
ファイル: portal.py プロジェクト: egorkAh/BombDash-server
    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)
コード例 #6
0
ファイル: airstrike.py プロジェクト: egorkAh/BombDash-server
 def init(self, actor: stdbomb.Bomb, position, velocity, materials):
     factory = stdbomb.BombFactory.get()
     actor.node = ba.newnode('prop', delegate=actor, attrs={
         'body': 'sphere',
         'model': factory.impact_bomb_model,
         'color_texture': ba.gettexture('ouyaAButton'),
         'position': position,
         'velocity': velocity,
         'shadow_size': 0.3,
         'reflection': 'powerup',
         'reflection_scale': [1.5],
         'materials': materials})
コード例 #7
0
ファイル: elonmine.py プロジェクト: egorkAh/BombDash-server
    def arm(self, actor: stdbomb.Bomb):
        factory = stdbomb.BombFactory.get()
        elon_mine_lit_tex = ba.gettexture('circleNoAlpha')
        elon_mine_tex = ba.gettexture('achievementCrossHair')
        actor.texture_sequence = ba.newnode('texture_sequence',
                                            owner=actor.node,
                                            attrs={
                                                'rate':
                                                30,
                                                'input_textures':
                                                (elon_mine_lit_tex,
                                                 elon_mine_tex)
                                            })
        ba.timer(0.5, actor.texture_sequence.delete)
        ba.playsound(ba.getsound('activateBeep'), position=actor.node.position)

        actor.aim = AutoAim(actor.node, actor.owner)
        # we now make it explodable.
        ba.timer(
            0.25,
            ba.WeakCall(actor._add_material, factory.land_mine_blast_material))
        actor.texture_sequence.connectattr('output_texture', actor.node,
                                           'color_texture')
コード例 #8
0
ファイル: stickygift.py プロジェクト: egorkAh/BombDash-server
 def init(self, actor: stdbomb.Bomb, position: Sequence[Union[int, float]],
          velocity: Sequence[Union[int, float]],
          materials: Sequence[ba.Material]):
     factory = StickyGiftFactory.get()
     materials += (factory.sticky_gift_material, )
     actor.node = ba.newnode('prop',
                             delegate=actor,
                             attrs={
                                 'body': 'sphere',
                                 'model': factory.sticky_gift_model,
                                 'light_model': factory.sticky_gift_model,
                                 'color_texture':
                                 factory.sticky_gift_texture,
                                 'position': position,
                                 'velocity': velocity,
                                 'shadow_size': 0.44,
                                 'reflection': 'sharper',
                                 'reflection_scale': [0, 8.5, 10],
                                 'materials': materials
                             })
コード例 #9
0
    def _on_bomb_exploded(self, bomb: Bomb, blast: Blast) -> None:
        assert blast.node
        pos = blast.node.position

        # Debugging: throw a locator down where we landed.
        # ba.newnode('locator', attrs={'position':blast.node.position})

        # Feed the explosion point to all our targets and get points in return.
        # Note: we operate on a copy of self._targets since the list may change
        # under us if we hit stuff (don't wanna get points for new targets).
        player = bomb.get_source_player()
        if not player:
            return  # could happen if they leave after throwing a bomb..

        bullseye = any(
            target.do_hit_at_position(pos, player)
            for target in list(self._targets))
        if bullseye:
            player.gamedata['streak'] += 1
        else:
            player.gamedata['streak'] = 0
コード例 #10
0
ファイル: race.py プロジェクト: Awesome-Logic/ballistica
 def _make_mine(self, i: int) -> None:
     assert self._race_mines is not None
     rmine = self._race_mines[i]
     rmine.mine = Bomb(position=rmine.point[:3], bomb_type='land_mine')
     rmine.mine.arm()
コード例 #11
0
ファイル: race.py プロジェクト: Awesome-Logic/ballistica
 def _spawn_bomb_at_pos(self, pos: Sequence[float]) -> None:
     if self.has_ended():
         return
     Bomb(position=pos, bomb_type='normal').autoretain()
コード例 #12
0
ファイル: stickygift.py プロジェクト: egorkAh/BombDash-server
    def arm(self, actor: stdbomb.Bomb):
        ba.playsound(ba.getsound('activateBeep'), position=actor.node.position)

        actor.aim = AutoAim(actor.node, actor.owner)
コード例 #13
0
ファイル: stickygift.py プロジェクト: egorkAh/BombDash-server
 def on_drop(self, actor: stdbomb.Bomb):
     actor.arm_timer = ba.Timer(
         0.25, ba.WeakCall(actor.handlemessage, stdbomb.ArmMessage()))
コード例 #14
0
 def _drop_bomb(self, position: Sequence[float],
                velocity: Sequence[float]) -> None:
     Bomb(position=position, velocity=velocity).autoretain()