本文整理汇总了C++中PlayerState::energy_max方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerState::energy_max方法的具体用法?C++ PlayerState::energy_max怎么用?C++ PlayerState::energy_max使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerState
的用法示例。
在下文中一共展示了PlayerState::energy_max方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_ships
void ObjectManager::create_ships(PlayerState& player_state)
{
for (int i = 1; i <= NUM_OF_POSSIBLE_PLAYERS; i++) {
if (player_state.energy_max(i)) {
std::string name = "Player " + std::to_string(i);
int s = player_state.score(i);
int e = player_state.energy_max(i);
player_state.set_energy(i, e); // reset energy to max
ObjIndex player_index = Object::parse_player_index(i);
sdlc::Surface& gfx = obj[player_index];
sdlc::Surface& hit_gfx = obj_hit[player_index];
auto w1 = create_main_weapon(i, player_state);
auto w2 = create_extra_weapon(i, player_state);
KeySet keyset(i); // For now we don't set custom keys
auto new_ship = std::make_shared<Ship>(name, e, s, gfx, hit_gfx, w1, w2, keyset);
new_ship->set_locked_to_screen(false);
new_ship->set_x((float)(213 * i - new_ship->width()));
new_ship->set_y(480);
new_ship->set_vel(0, -200.0f);
queue.push_back(new_ship);
}
}
}