示例#1
0
 def try_handle_click(self, mouse_position):
     # logger.debug('CreateNewTowerClickHandler')
     if sprite_groups.selected_tower_icon_sprite:
         new_tower = tower.create_tower(sprite_groups.selected_tower_icon_sprite.sprite._tower_type, mouse_position,
                                        DISPLAYSURF)
         #make sure player has enough money to make this tower
         if bank.balance >= new_tower.buy_price:
             bank.withdraw(new_tower.buy_price)
             sprite_groups.tower_sprites.add(new_tower)
         sprite_groups.selected_tower_icon_sprite.empty()
         return True
     return False
示例#2
0
 def try_handle_click(self, mouse_position):
     # logger.debug('CreateNewTowerClickHandler')
     if sprite_groups.selected_tower_icon_sprite:
         new_tower = tower.create_tower(
             sprite_groups.selected_tower_icon_sprite.sprite._tower_type,
             mouse_position, DISPLAYSURF)
         #make sure player has enough money to make this tower
         if bank.balance >= new_tower.buy_price:
             bank.withdraw(new_tower.buy_price)
             sprite_groups.tower_sprites.add(new_tower)
         sprite_groups.selected_tower_icon_sprite.empty()
         return True
     return False
示例#3
0
 def try_handle_click(self, mouse_position):
     # logger.debug('CreateNewTowerClickHandler')
     if sprite_groups.selected_tower_icon_sprite:
         new_tower = tower.create_tower(sprite_groups.selected_tower_icon_sprite.sprite._tower_type, mouse_position,
                                        DISPLAYSURF)
         # make sure player has enough money to make this tower
         if bank.balance >= new_tower.buy_price:
             bank.withdraw(new_tower.buy_price)
             sprite_groups.tower_sprites.add(new_tower)
             # logger.debug('about to send message')
             message_buffer.push_create_new_tower_message(tower_id=id(new_tower),
                                                          tower_type=new_tower.tower_type,
                                                          speed=new_tower._attack_values.speed,
                                                          radius=new_tower._attack_values.radius,
                                                          pop_power=new_tower._attack_values.pop_power,
                                                          x_pos=new_tower.rect.centerx,
                                                          y_pos=new_tower.rect.centery)
         sprite_groups.selected_tower_icon_sprite.empty()
         return True
     return False
示例#4
0
 def try_handle_click(self, mouse_position):
     # logger.debug('CreateNewTowerClickHandler')
     if sprite_groups.selected_tower_icon_sprite:
         new_tower = tower.create_tower(
             sprite_groups.selected_tower_icon_sprite.sprite._tower_type,
             mouse_position, DISPLAYSURF)
         # make sure player has enough money to make this tower
         if bank.balance >= new_tower.buy_price:
             bank.withdraw(new_tower.buy_price)
             sprite_groups.tower_sprites.add(new_tower)
             # logger.debug('about to send message')
             message_buffer.push_create_new_tower_message(
                 tower_id=id(new_tower),
                 tower_type=new_tower.tower_type,
                 speed=new_tower._attack_values.speed,
                 radius=new_tower._attack_values.radius,
                 pop_power=new_tower._attack_values.pop_power,
                 x_pos=new_tower.rect.centerx,
                 y_pos=new_tower.rect.centery)
         sprite_groups.selected_tower_icon_sprite.empty()
         return True
     return False
示例#5
0
    def test_create_tower_with_TELEPORTATION_TOWER_type(self):
        tower_type = tower.TELEPORTATION_TOWER
        return_value = tower.create_tower(tower_type, self.position, self.DISPLAYSURF)

        self.assertIsInstance(return_value, tower.TeleportationTower)
示例#6
0
    def test_create_tower_with_EXPLOSION_TOWER_type(self):
        tower_type = tower.EXPLOSION_TOWER
        return_value = tower.create_tower(tower_type, self.position, self.DISPLAYSURF)

        self.assertIsInstance(return_value, tower.ExplosionTower)
示例#7
0
    def test_create_tower_with_THREE_SIXTY_TOWER_type(self):
        tower_type = tower.THREE_SIXTY_TOWER
        return_value = tower.create_tower(tower_type, self.position, self.DISPLAYSURF)

        self.assertIsInstance(return_value, tower.ThreeSixtyTower)
示例#8
0
    def test_create_tower_with_LINEAR_TOWER_type(self):
        tower_type = tower.LINEAR_TOWER
        return_value = tower.create_tower(tower_type, self.position, self.DISPLAYSURF)

        self.assertIsInstance(return_value, tower.LinearTower)
示例#9
0
    def test_create_tower_with_TELEPORTATION_TOWER_type(self):
        tower_type = tower.TELEPORTATION_TOWER
        return_value = tower.create_tower(tower_type, self.position,
                                          self.DISPLAYSURF)

        self.assertIsInstance(return_value, tower.TeleportationTower)
示例#10
0
    def test_create_tower_with_EXPLOSION_TOWER_type(self):
        tower_type = tower.EXPLOSION_TOWER
        return_value = tower.create_tower(tower_type, self.position,
                                          self.DISPLAYSURF)

        self.assertIsInstance(return_value, tower.ExplosionTower)
示例#11
0
    def test_create_tower_with_THREE_SIXTY_TOWER_type(self):
        tower_type = tower.THREE_SIXTY_TOWER
        return_value = tower.create_tower(tower_type, self.position,
                                          self.DISPLAYSURF)

        self.assertIsInstance(return_value, tower.ThreeSixtyTower)
示例#12
0
    def test_create_tower_with_LINEAR_TOWER_type(self):
        tower_type = tower.LINEAR_TOWER
        return_value = tower.create_tower(tower_type, self.position,
                                          self.DISPLAYSURF)

        self.assertIsInstance(return_value, tower.LinearTower)