Beispiel #1
0
Rally::Rally():
    Game(games::gRally) {

    settings::C_EnabledWeapons  = settings::C_EnabledWeaponsByUser;
    settings::C_EnabledSpecials = settings::C_EnabledSpecialsByUser;

    music::play();

    if (settings::C_playerIteamL  | settings::C_playerIteamR)
        players::addPlayer (teams::addTeam(new DMTeam(settings::C_playerITeamColor)), controllers::cPlayer1);
    if (settings::C_playerIIteamL | settings::C_playerIIteamR)
        players::addPlayer (teams::addTeam(new DMTeam(settings::C_playerIITeamColor)), controllers::cPlayer2);

    for (int i=0; i<settings::C_botsDeath; ++i) {
        Team* newTeam = teams::addTeam(new DMTeam());
        Color3f color(newTeam->color());
        color.h(newTeam->color().h()+10*randomizer::random(-5, 5));
        color.v(newTeam->color().v()+randomizer::random(-0.5f, 0.5f));
        players::addPlayer(newTeam, controllers::cBot, color);
    }

    Home* home = spaceObjects::addHome(HOME_RALLY, 100, Color3f(1.f, 1.f, 1.f));
    teams::assignHomes(home);
    players::createShips();

    //spaceObjects::populateSpace(5.f, 10.f, 4);
    zones::createRaster(4,3);

    track_ = new Track(home);
}
Beispiel #2
0
DeathMatch::DeathMatch():
    Game(games::gDeathMatch) {

    settings::C_EnabledWeapons  = settings::C_EnabledWeaponsByUser;
    settings::C_EnabledSpecials = settings::C_EnabledSpecialsByUser;

    music::play();

    if (settings::C_playerIteamL  | settings::C_playerIteamR)
        players::addPlayer (teams::addTeam(new DMTeam(settings::C_playerITeamColor)), controllers::cPlayer1);
    if (settings::C_playerIIteamL | settings::C_playerIIteamR)
        players::addPlayer (teams::addTeam(new DMTeam(settings::C_playerIITeamColor)), controllers::cPlayer2);

    for (int i=0; i<settings::C_botsDeath; ++i) {
        Team* newTeam = teams::addTeam(new DMTeam());
        Color3f color(newTeam->color());
        color.h(newTeam->color().h()+10*randomizer::random(-5, 5));
        color.v(newTeam->color().v()+randomizer::random(-0.5f, 0.5f));
        players::addPlayer(newTeam, controllers::cBot, color);
    }

    teams::assignHomes(spaceObjects::addHome(HOME_MIDDLE, 100, Color3f(0.9f, 0.7f, 1.0f)));
    players::createShips();

    spaceObjects::populateSpace(5.f, 10.f, 4);
    zones::createRaster(4,3);
}
Beispiel #3
0
Team::Team(Stage* stage, const Team& team)
	: QObject(stage),
	color_(team.color()),
	goals_(team.goals()),
	yellowCards_(team.yellowCards()),
	redCards_(team.redCards())
{
	stage_ = stage;
	for(int i=0; i<team.size(); i++){
		Robot* r = new Robot( *(team.at(i)) );
		r->setTeam(this);
		r->setStage(stage);
		this->push_back(r);
	}
	
}
Beispiel #4
0
SpaceBall::SpaceBall():
    Game(games::gSpaceBall) {

    settings::C_EnabledWeapons  = settings::C_EnabledWeaponsByUser;
    settings::C_EnabledSpecials = settings::C_EnabledSpecialsByUser;

    music::play();

    Team* myTeamL = NULL;
    Team* myTeamR = NULL;

    if (settings::C_playerIteamL) {
        myTeamL = new SBTeam(settings::C_playerITeamColor);
        players::addPlayer(myTeamL, controllers::cPlayer1);
    }
    else if (settings::C_playerIteamR) {
        myTeamR = new SBTeam(settings::C_playerITeamColor);
        players::addPlayer(myTeamR, controllers::cPlayer1);
    }

    if (settings::C_playerIIteamL) {
        if (!myTeamL) myTeamL = new SBTeam(settings::C_playerIITeamColor);
        players::addPlayer(myTeamL, controllers::cPlayer2);
    }
    else if (settings::C_playerIIteamR) {
        if (!myTeamR) myTeamR = new SBTeam(settings::C_playerIITeamColor);
        players::addPlayer(myTeamR, controllers::cPlayer2);
    }

    if (!myTeamR && !myTeamL) {
        Color3f rand = Color3f::random();
        myTeamL = new SBTeam(rand.inverted());
        myTeamR = new SBTeam(rand);

    }
    else if (!myTeamL) {
        myTeamL = new SBTeam(myTeamR->color().inverted());
    }
    else if (!myTeamR) {
        myTeamR = new SBTeam(myTeamL->color().inverted());
    }

    teams::addTeam(myTeamL);
    teams::addTeam(myTeamR);

    for (int i=0; i<settings::C_botsLeft;  ++i)                       players::addPlayer(myTeamL, controllers::cBot);
    for (int i=0; i<settings::C_botsRight;  ++i)                      players::addPlayer(myTeamR, controllers::cBot);

    Home* homeL = spaceObjects::addHome(HOME_LEFT, settings::C_pointLimitSB, myTeamL->color());
    Home* homeR = spaceObjects::addHome(HOME_RIGHT, settings::C_pointLimitSB, myTeamR->color());

    teams::assignHomes(homeL, homeR);
    players::createShips();

    balls::addBall();

    spaceObjects::populateSpace(5.f, 10.f, 4);

    zones::detectTacticalZones();
    zones::createRaster(4, 3);
}