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
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
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
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
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)
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)
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)
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)