示例#1
0
void Title::update( Controller::NoState::SceneName* next_scene_name,
                    Constants::PlayMode* play_mode)
{
    const Constants::PlayMode modes[]
    = {Constants::PlayMode1P, Constants::PlayMode2P};

    GameLib::Framework f = GameLib::Framework::instance();

    ::Game::InputManager user1_input = ::Game::InputManager::user1();

    if (user1_input.is_option())
    {
        *next_scene_name = Controller::NoState::SceneGame;
        *play_mode = modes[looped_index_];
    }
    else if (user1_input.is_top_triggered())
    {
        ++looped_index_;
    }
    else if (user1_input.is_bottom_triggered())
    {
        --looped_index_;
    }

    f.drawDebugString(0, 0, "[TITLE]", 0xffffffff);
    f.drawDebugString(1, 1, "1P Mode", 0xffffffff);
    f.drawDebugString(1, 2, "2P Mode", 0xffffffff);
    f.drawDebugString(0, looped_index_ + 1, ">", 0xffffffff);
}
示例#2
0
void Success::update(State* state, Controller::Game::SceneName* next_scene_name)
{
    GameLib::Framework f = GameLib::Framework::instance();
    ::Game::InputManager user1_input = ::Game::InputManager::user1();

    if (user1_input.is_option())
    {
        *next_scene_name = Controller::Game::SceneNoStateEnding;
    }

    f.drawDebugString(0, 0, "SUCCESS!!!", 0xffffffff);
    state->draw();
}
示例#3
0
bool RuleBase::can_reverse_direction(	const Object::Enemy& self,
										int friends_size,
										const Object::Enemy* friends,
										int self_index) const
{
	for (int i = 0; i < friends_size; ++i)
	{
		if (i == self_index)
		{
			continue;
		}

		if (friends[i].point() == self.point())
		{
			return false;
		}
	}

	GameLib::Framework f = GameLib::Framework::instance();

	return f.getRandom(MaxRate) < reverse_rate_at_moving_;
}
示例#4
0
Point RuleBase::select_direction(	const Object::Enemy& self,
									const Map& map,
									int friends_size,
									const Object::Enemy* friends,
									int self_index)
{
	int rates[4];
	Point next_candidates[4];

	// do not change the original
	for (int i = 0; i < 4; ++i)
	{
		rates[i] = direction_rates_[i];
	}

	for (int i = 0; i < 4; ++i)
	{
		next_candidates[i] = self.point() + Directions[i];

		if (map.can_not_invade(next_candidates[i]))
		{
			rates[i] = 0;
		}
	}

	for (int i = 0; i < friends_size; ++i)
	{
		if (i == self_index)
		{
			continue;
		}

		if (friends[i].point() == next_candidates[i])
		{
			rates[i] = 0;
		}
		else if (friends[i].current_point() == next_candidates[i])
		{
			rates[i] = 0;
		}
	}
	
	normalize_rate(rates);

	if ((rates[0] + rates[1] + rates[2] + rates[3]) == 0)
	{
		return Point(0, 0);
	}

	GameLib::Framework f = GameLib::Framework::instance();

	int rate = f.getRandom(MaxRate);
	int index = 0;
	int sum = 0;

	for (int i = 0; i < 4; ++i)
	{
		sum = sum + rates[i];

		if (sum > rate)
		{
			index = i;
			break;
		}
	}

	return Directions[index];
}
示例#5
0
AppStatus::ITEM AppStatus::randomItem(){
	GameLib::Framework f = GameLib::Framework::instance();
	return static_cast<ITEM>(f.getRandom(4));
}