Ejemplo n.º 1
0
void game_cl_TeamDeathmatch::shedule_Update			(u32 dt)
{
	CStringTable st;
	string512	msg;

	if(!m_game_ui && HUD().GetUI() ) m_game_ui = smart_cast<CUIGameTDM*>( HUD().GetUI()->UIGame() );
	inherited::shedule_Update(dt);

	if (!m_game_ui) return;
	//---------------------------------------------------------
	if (m_game_ui->m_pUITeamSelectWnd && m_game_ui->m_pUITeamSelectWnd->IsShown() && !CanCallTeamSelectMenu())
		StartStopMenu(m_game_ui->m_pUITeamSelectWnd,true);
	//---------------------------------------------------------
	
	switch (m_phase)
	{
	case GAME_PHASE_TEAM1_SCORES:
		{
			sprintf_s(msg, /*team %s wins*/ *st.translate("mp_team_wins"), CTeamInfo::GetTeam_name(1));
			m_game_ui->SetRoundResultCaption(msg);

			SetScore();
		}break;
	case GAME_PHASE_TEAM2_SCORES:
		{
			sprintf_s(msg, /*team %s wins*/ *st.translate("mp_team_wins"), CTeamInfo::GetTeam_name(2));
			m_game_ui->SetRoundResultCaption(msg);
			
			SetScore();
			
		}break;
	case GAME_PHASE_INPROGRESS:
		{
			if (local_player && !local_player->IsSkip())
			{			
				if (Level().CurrentEntity() && Level().CurrentEntity()->CLS_ID == CLSID_SPECTATOR)
				{
					if (!(pCurBuyMenu && pCurBuyMenu->IsShown()) && 
						!(pCurSkinMenu && pCurSkinMenu->IsShown()) &&
						!(m_game_ui->m_pMapDesc && m_game_ui->m_pMapDesc->IsShown()) &&
						(HUD().GetUI() && HUD().GetUI()->GameIndicatorsShown())
						)
					{
						if (!m_bTeamSelected)
							m_game_ui->SetPressJumpMsgCaption("mp_press_jump2select_team");
					};
				};
				SetScore();
			};
		}break;
	default:
		{
		}break;
	};

}
Ejemplo n.º 2
0
void Bejeweled::Resize(int xsize,int ysize) {
	Clear();
	
	this->xsize = xsize;
	this->ysize = ysize;

	grid.resize(xsize);
	for(int x = 0;x < xsize;x++) {
		grid[x].resize(ysize);
	}
	
	for(int x = 0;x < xsize;x++) {
		for(int y = 0;y < ysize;y++) {
			grid[x][y] = new Jewel(GetRandomJewel(),x,y+ysize);
			grid[x][y]->SetPosition(x,y,true);
		}
	}
	
	// Center camera
	float3 focus = float3(2 * (xsize-1)/2,2 * (ysize-1)/2,0);

	// Make sure the camera views everything
	float distance = 2.5f * xsize/(2 * tan(camera->fov/2)); // allow 80% extra vision
	
	camera->SetPos(focus + float3(0.001,0.001,distance));
	camera->SetLookAt(focus);
	
	// Center background
	background->SetTranslation(float3(xsize-1,ysize-1 - 128,-1));
		
	// Update field
	Update();
	SetScore(0);
}
Ejemplo n.º 3
0
//
// AICTPGameGameMode::InitialisePlayerController
//
ARobotPlayerController* AICTPGameGameMode::InitialisePlayerController( EPlayerID PlayerID )
{
	auto World = GetWorld();
	check( World );

	// Get or create the player controller.
	auto PlayerController = UGameplayStatics::GetPlayerController( World, static_cast<int32>( PlayerID ) );
	if( PlayerController == nullptr )
	{
		// Try and create the player controller, since it doesn't appear to exist.
		PlayerController = UGameplayStatics::CreatePlayer( World, static_cast<int32>( PlayerID ), true );
	}
	check( PlayerController );

	auto RobotPlayerController = Cast<ARobotPlayerController>( PlayerController );
	if( RobotPlayerController == nullptr )
	{
		return nullptr;
	}
	//check( RobotPlayerController );

	FColor Colour = GetColourFromPlayerID( PlayerID );
	RobotPlayerController->SetColour( Colour );
	RobotPlayerController->SetScore( 0 );

	return RobotPlayerController;
}
Ejemplo n.º 4
0
void BPMiniGame_PatchMatch::OnMouseUp() {
	if (SelectedBox == NULL) return;
	if (Locked) return;
	
	for (int i = 0; i < Boxes.size(); ++i) {
		vector<BPMiniGame_PatchMatch_Box*>* row = Boxes[i];
		
		for (int j = 0; j < row->size(); ++j) {
			BPMiniGame_PatchMatch_Box* box = (*row)[j];
			
			if (box == SelectedBox) continue;
			
			if (box->Colour != SelectedBox->Colour) continue;
			
			if (TheGame->RectOverRect(SelectedBox->DrawX, SelectedBox->DrawY, BoxSize, BoxSize, box->X, box->Y, BoxSize, BoxSize)) {
				box->MatchTime = TheGame->TickCount;
				SelectedBox->MatchTime = TheGame->TickCount;
				
				Score += 1;
				SetScore();
				
				TheGame->PlaySound("gem_select");
				
				SelectedBox = NULL;
				return;
			}
		}
	}
	
	SelectedBox->DrawX = SelectedBox->X;
	SelectedBox->DrawY = SelectedBox->Y;
	SelectedBox = NULL;
}
Ejemplo n.º 5
0
void TargetPhrase::SetScore(float score)
{
  //we use an existing score producer to figure out information for score setting (number of scores and weights)
  //TODO: is this a good idea?
  // Assume the default system.
  const TranslationSystem& system =  StaticData::Instance().GetTranslationSystem(TranslationSystem::DEFAULT);
  const ScoreProducer* prod = system.GetPhraseDictionaries()[0];

  //get the weight list
  unsigned int id = prod->GetScoreBookkeepingID();

  const vector<float> &allWeights = StaticData::Instance().GetAllWeights();

  size_t beginIndex = StaticData::Instance().GetScoreIndexManager().GetBeginIndex(id);
  size_t endIndex = StaticData::Instance().GetScoreIndexManager().GetEndIndex(id);

  vector<float> weights;

  std::copy(allWeights.begin() +beginIndex, allWeights.begin() + endIndex,std::back_inserter(weights));

  //find out how many items are in the score vector for this producer
  size_t numScores = prod->GetNumScoreComponents();

  //divide up the score among all of the score vectors
  vector <float> scoreVector(numScores,score/numScores);

  //Now we have what we need to call the full SetScore method
  SetScore(prod,scoreVector,weights,system.GetWeightWordPenalty(),system.GetLanguageModels());
}
Ejemplo n.º 6
0
void Player::Initialize(const glm::vec2 &StartPosition)
{
	if( m_Sprite->GetRenderState() == NULL )
	{
		m_Sprite->SetRenderState(GLESRenderer::Instance()->AddRenderState(RenderState(GLESRenderer::Instance()->GetShader("tiles"), RenderState::BLENDING_ENABLED)));
	}

	m_Hitbox.m_Position = StartPosition - glm::vec2(m_Hitbox.m_Size.x / 2.f, m_Hitbox.m_Size.y);
	m_Velocity = glm::vec2(0, 0);
	m_IsOnGround = false;
	m_IsPressingDown = false;

	ReleaseWeapons();
	LoadWeapon("data/weapons/1/weapon1.json");
	LoadWeapon("data/weapons/2/weapon2.json");

	m_CurrentWeaponIndex = 0;

	SetState(IDLE);

	SetScore(0);
	SetHealth(3);
	m_Energy = 3;
	for( size_t i = 0; i < HUD::NUMBER_OF_LETTERS; ++i )
	{
		m_BonusLetters[i] = false;
	}
}
Ejemplo n.º 7
0
    virtual void PXCAPI OnRecognition(const PXCSpeechRecognition::RecognitionData *data) {
        if (data->scores[0].label<0) {
            PrintConsole(m_hWnd,(pxcCHAR*)data->scores[0].sentence);
            if (data->scores[0].tags[0])
                PrintConsole(m_hWnd,(pxcCHAR*)data->scores[0].tags);
        } else {
            ClearScores(m_hWnd);
            for (int i=0; i<sizeof(data->scores)/sizeof(data->scores[0]); i++) {
                if (data->scores[i].label < 0 || data->scores[i].confidence == 0) continue;
                SetScore(m_hWnd,data->scores[i].label,data->scores[i].confidence);
            }

            // Dispatch differnt work here
            switch (data->scores[0].label) {
            case 0:
                PrintStatus(m_hWnd, (pxcCHAR*)L"Reading text for you, my pleasure.");
                break;
            case 1:
                PrintStatus(m_hWnd, (pxcCHAR*)L"Yes master, Avery and Lasse are smiling.");
                break;
            case 2:
                PrintStatus(m_hWnd, (pxcCHAR*)L"Today is sunday.");
                break;
            default:
                break;
            }

            if (data->scores[0].tags[0])
                PrintStatus(m_hWnd,(pxcCHAR*)data->scores[0].tags);
        }
    }
Ejemplo n.º 8
0
ScoreBoardManager::Entry::Entry( uint32_t inPlayerId, const string& inPlayerName, const Vector3& inColor ) :
mPlayerId( inPlayerId ),
mPlayerName( inPlayerName ),
mColor( inColor )
{
	SetScore( 0 );
}
Ejemplo n.º 9
0
bool Player::DeleteScore(int deleteScore)
{
	if(mScore < deleteScore)
		return false;
	mScore -= deleteScore;
	SetScore(mScore);
	return true;
}
Ejemplo n.º 10
0
void Score3D::OnNodeSet(Node* node)
{ if(!node) return;

    node_->SetRotation(Quaternion(180.0f, Vector3::UP));

    SetAlignRight(false);
    AddDigit();
    SetScore(0);//node_->GetName().Contains("High") ? GLOBAL->GetHighscore() : 0 );
}
Ejemplo n.º 11
0
cObjective::Score cObjective::SubScore(const AString & a_Name, cObjective::Score a_Delta)
{
	// TODO 2014-01-19 xdot: Potential optimization - Reuse iterator
	Score NewScore = m_Scores[a_Name] - a_Delta;

	SetScore(a_Name, NewScore);

	return NewScore;
}
Ejemplo n.º 12
0
// Square enemy
//------------------------------
Square::Square( const Vec2& position, fixed rotation )
: Enemy( position, 4 )
, _dir()
, _timer( z_rand() % 80 + 40 )
{
    AddShape( new Box( Vec2(), 10, 10, 0x33ff33ff, 0, ENEMY | VULNERABLE ) ); _dir.SetPolar( rotation, M_ONE );
    SetScore( 25 );
    SetBoundingWidth( 15 );
    SetEnemyValue( 2 );
}
Ejemplo n.º 13
0
// Follower enemy
//------------------------------
Follow::Follow( const Vec2& position, fixed radius, int hp )
: Enemy( position, hp )
, _timer( 0 )
, _target( 0 )
{
    AddShape( new Polygon( Vec2(), radius, 4, 0x9933ffff, 0, ENEMY | VULNERABLE ) );
    SetScore( 15 );
    SetBoundingWidth( 10 );
    SetDestroySound( Lib::SOUND_ENEMY_SHATTER );
    SetEnemyValue( 1 );
}
Ejemplo n.º 14
0
void Player::initPlayer(CCLayer* gameLayer)
{
	mGameLayer = gameLayer;
	mThreatenInfo.mRangeScale = 1.0f;
	mThreatenInfo.mSpeedScale = 1.0f;
	mThreatenInfo.mTimeScale = 1.0f;
	mCoinAddPoint = 0;
	mCoinDoublePoint = 0;
	mLevel = 0;
	mExperience = 0;
	mScore = 20000;
	mPointList[0] = 0;
	mPointList[1] = 0;
	mPointList[2] = 0;
	mPointList[3] = 0;
	mPointList[4] = 0;

	
	/*
	const char* testPlistPath = "player/player.plist";
	std::string str1 = CCFileUtils::sharedFileUtils()->fullPathForFilename(testPlistPath);
	CCDictionary* plistDic = CCDictionary::createWithContentsOfFile(str1.c_str());
	char str[64] = {0};
	mLevel = plistDic->valueForKey("level")->intValue();
	mExperience = plistDic->valueForKey("experience")->intValue();
	mScore = plistDic->valueForKey("coin")->intValue();
	mPointList[0] = plistDic->valueForKey("rangePoint")->intValue();
	mPointList[1] = plistDic->valueForKey("timePoint")->intValue();
	mPointList[2] = plistDic->valueForKey("speedPoint")->intValue();
	mPointList[3] = plistDic->valueForKey("addCoinPoint")->intValue();
	mPointList[4] = plistDic->valueForKey("doubleCoinPoint")->intValue();*/

	mLevel = LoadIntegerFromXML("level",mLevel);
	mExperience = LoadIntegerFromXML("experience",mExperience);
	mScore = LoadIntegerFromXML("coin",mScore);
	mPointList[0] = LoadIntegerFromXML("rangePoint",mPointList[0]);
	mPointList[1] = LoadIntegerFromXML("timePoint",mPointList[1]);
	mPointList[2] = LoadIntegerFromXML("speedPoint",mPointList[2]);
	mPointList[3] = LoadIntegerFromXML("addCoinPoint",mPointList[3]);
	mPointList[4] = LoadIntegerFromXML("doubleCoinPoint",mPointList[4]);

	mNextLevelExperience = GetTotalExperience(mLevel);
	mMainFrame = UIMgr::Instance()->GetMainFrame();
	mMainFrame->SetLevel(mLevel);
	mMainFrame->SetExperience(100*mExperience/GetTotalExperience(mLevel));
	mThreatenInfo.mRangeScale = 1.0f + 0.1*mPointList[0];
	mThreatenInfo.mTimeScale = 1.0f + 0.1*mPointList[1];
	mThreatenInfo.mSpeedScale = 1.0f + 0.1*mPointList[2];
	SetCoinAddPoint(mPointList[3]);
	SetCoinDoublePoint(mPointList[4]);
	SetScore(mScore);

	mGameLayer->schedule(schedule_selector(Player::Tick), 5.0f);
}
Ejemplo n.º 15
0
// Wall enemy
//------------------------------
Wall::Wall( const Vec2& position, bool rdir )
: Enemy( position, 10 )
, _dir( 0, 1 )
, _timer( 0 )
, _rotate( false )
, _rdir( rdir )
{
    AddShape( new Box( Vec2(), 10, 40, 0x33cc33ff, 0, ENEMY | VULNERABLE ) );
    SetScore( 20 );
    SetBoundingWidth( 50 );
    SetEnemyValue( 4 );
}
Ejemplo n.º 16
0
// Chaser enemy
//------------------------------
Chaser::Chaser( const Vec2& position )
: Enemy( position, 2 )
, _move( false )
, _timer( TIME )
, _dir()
{
    AddShape( new Polygram( Vec2(), 10, 4, 0x3399ffff, 0, ENEMY | VULNERABLE ) );
    SetScore( 30 );
    SetBoundingWidth( 10 );
    SetDestroySound( Lib::SOUND_ENEMY_SHATTER );
    SetEnemyValue( 2 );
}
Ejemplo n.º 17
0
void Bejeweled::Refill() {
	int oldscore = score;
	for(int x = 0;x < xsize;x++) {
		for(int y = 0;y < ysize;y++) {
			delete grid[x][y];
			grid[x][y] = new Jewel(GetRandomJewel(),x,y+ysize);
			grid[x][y]->SetPosition(x,y,true);
		}
	}
	Deselect();
	Update();
	SetScore(oldscore); // do NOT give points for random combos
}
Ejemplo n.º 18
0
void Player::AddScore(int addScore)
{
	mScore += addScore;
	SetScore(mScore);
	mExperience += addScore;
	while( mExperience >= mNextLevelExperience)
	{
		mExperience -= mNextLevelExperience;
		mLevel ++;
		mNextLevelExperience = GetTotalExperience(mLevel);
		mMainFrame->SetLevel(mLevel);
	}
	mMainFrame->SetExperience(100*mExperience/GetTotalExperience(mLevel));
}
Ejemplo n.º 19
0
void Game::Initialise()
{
	// Initialise the scores and wave information
	SetScore(0);
	SetWave(1);
	SetHighScore(HighScores::GetHighScore());
	SetLives(NUM_LIVES);

	// Initialise the shields.
	InitialiseShields();

	// Create a new wave
	InitialiseWave();
}
/**
 * used for setting scores for unknown words with input link features (lattice/conf. nets)
 * \param scoreVector input scores
 */
void TargetPhrase::SetScore(const TranslationSystem* system, const Scores &scoreVector)
{
	//we use an existing score producer to figure out information for score setting (number of scores and weights)

    const ScoreProducer* prod = system->GetPhraseDictionaries()[0];

	vector<float> weights = StaticData::Instance().GetWeights(prod);
	
	//expand the input weight vector
	CHECK(scoreVector.size() <= prod->GetNumScoreComponents());
	Scores sizedScoreVector = scoreVector;
	sizedScoreVector.resize(prod->GetNumScoreComponents(),0.0f);

	SetScore(prod,sizedScoreVector, ScoreComponentCollection(),weights,system->GetWeightWordPenalty(),system->GetLanguageModels());
}
Ejemplo n.º 21
0
BPMiniGame_PatchMatch::BPMiniGame_PatchMatch(BPGame* game) : BPMiniGame(game) {
	sfcBackground = TheGame->LoadBitmap("patchmatch", 512, 512);
	
	Locked = false; // when true disallow movement
	TimeStarted = 0;
	SuccessTime = -1;
	
	sfcClock = sfcScoreStr = NULL;
	SelectedBox = NULL;
	
	DisappearTime = 400;
	
	Score = 0;
	SetScore();
	
	GameTitle = "Patch Match";
	GameHelp = "Tap on any shape, then drag it onto a square with the same picture to score points. It sounds easy enough, but can you stay focused for two minutes?";
	GameHelp2 = "Not every box will have a match on the screen at any given time, so you need to look hard and find matches wherever you can.";
	
	MiniGameType = PUZZLE;
	
	for (int i = 1; i <= 59; ++i) {
		ostringstream filename;
		filename << "patch" << i;
		PatchPictures.Add(TheGame->LoadBitmap(filename.str().c_str(), 48, 48));
	}
	
	for (int j = 0; j < 7; ++j) {
		vector<BPMiniGame_PatchMatch_Box*>* row = new vector<BPMiniGame_PatchMatch_Box*>();
		
		for (int i = 0; i < 6; ++i) {
			BPMiniGame_PatchMatch_Box* box = new BPMiniGame_PatchMatch_Box();
			box->X = 36 + (i * 50);
			box->Y = 36 + (j * 50);
			box->DestY = 36 + (j * 50);
			box->DrawX = box->X;
			box->DrawY = box->Y;
			box->Colour = TheGame->RandomRange(0, PatchPictures.Count - 1);
			row->push_back(box);
		}
		
		Boxes.push_back(row);
	}
}
Ejemplo n.º 22
0
bool ScoreBoardManager::Entry::Read( InputMemoryBitStream& inInputStream )
{
	bool didSucceed = true;

	inInputStream.Read( mColor );
	inInputStream.Read( mPlayerId );

	inInputStream.Read( mPlayerName );

	int score;
	inInputStream.Read( score );
	if( didSucceed )
	{
		SetScore( score );
	}


	return didSucceed;
}
Ejemplo n.º 23
0
// Tractor beam enemy
//------------------------------
Tractor::Tractor( const Vec2& position, bool power )
: Enemy( position, 50 )
, _timer( TIMER * 4 )
, _dir( 0, 0 )
, _power( power )
, _ready( false )
, _spinning( false )
{
    AddShape( new Polygram( Vec2( 24,  0 ), 12, 6, 0xcc33ccff, 0,  ENEMY | VULNERABLE ) );
    AddShape( new Polygram( Vec2( -24, 0 ), 12, 6, 0xcc33ccff, 0,  ENEMY | VULNERABLE ) );
    AddShape( new Line    ( Vec2( 0,   0 ), Vec2( 24, 0 ), Vec2( -24, 0 ), 0xcc33ccff ) );
    if ( power ) {
        AddShape( new Polystar( Vec2( 24,  0 ), 16, 6, 0xcc33ccff, 0, 0 ) );
        AddShape( new Polystar( Vec2( -24, 0 ), 16, 6, 0xcc33ccff, 0, 0 ) );
    }
    SetScore( 85 + power * 40 );
    SetBoundingWidth( 36 );
    SetDestroySound( Lib::SOUND_PLAYER_DESTROY );
    SetEnemyValue( 10 + ( power ? 2 : 0 ) );
}
void TargetPhrase::SetScore(float score)
{
	//we use an existing score producer to figure out information for score setting (number of scores and weights)
	//TODO: is this a good idea?
    // Assume the default system.
    const TranslationSystem& system =  StaticData::Instance().GetTranslationSystem(TranslationSystem::DEFAULT);
	const ScoreProducer* prod = system.GetPhraseDictionaries()[0];
	
	vector<float> weights = StaticData::Instance().GetWeights(prod);

	
	//find out how many items are in the score vector for this producer	
	size_t numScores = prod->GetNumScoreComponents();

	//divide up the score among all of the score vectors
	vector <float> scoreVector(numScores,score/numScores);
	
	//Now we have what we need to call the full SetScore method
	SetScore(prod, scoreVector, ScoreComponentCollection(), weights, system.GetWeightWordPenalty(), system.GetLanguageModels());
}
Ejemplo n.º 25
0
/**
 * used for setting scores for unknown words with input link features (lattice/conf. nets)
 * \param scoreVector input scores
 */
void TargetPhrase::SetScore(const TranslationSystem* system, const Scores &scoreVector)
{
  //we use an existing score producer to figure out information for score setting (number of scores and weights)

  const ScoreProducer* prod = system->GetPhraseDictionaries()[0];

  //get the weight list
  unsigned int id = prod->GetScoreBookkeepingID();
  const vector<float> &allWeights = StaticData::Instance().GetAllWeights();
  size_t beginIndex = StaticData::Instance().GetScoreIndexManager().GetBeginIndex(id);
  size_t endIndex = StaticData::Instance().GetScoreIndexManager().GetEndIndex(id);
  vector<float> weights;
  std::copy(allWeights.begin() +beginIndex, allWeights.begin() + endIndex,std::back_inserter(weights));

  //expand the input weight vector
  assert(scoreVector.size() <= prod->GetNumScoreComponents());
  Scores sizedScoreVector = scoreVector;
  sizedScoreVector.resize(prod->GetNumScoreComponents(),0.0f);

  SetScore(prod,sizedScoreVector,weights,system->GetWeightWordPenalty(),system->GetLanguageModels());
}
Ejemplo n.º 26
0
bool nGame::InitGame()
{
	// Reset score and health
	SetScore(0);
	SetHealth(100);

	// Reset missle time
	SetMissleTime(GAME_MISSLE_TIME);

	// Add two silos
	AddSilo(nVector2(nGetInstance()->GetGraphics()->GetDisplaySize().cx/3.0f,nGetInstance()->GetGraphics()->GetDisplaySize().cy),GAME_FRENDLY_COLOR);
	AddSilo(nVector2(nGetInstance()->GetGraphics()->GetDisplaySize().cx/1.3f,nGetInstance()->GetGraphics()->GetDisplaySize().cy),GAME_FRENDLY_COLOR);

	// Reset cursor position
	nGetInstance()->GetInput()->GetMouse()->SetPosition(nVector2(nGetInstance()->GetGraphics()->GetDisplaySize().cx / 2,nGetInstance()->GetGraphics()->GetDisplaySize().cy / 2));

	// Start paused
	SetPause(true);

	return true;
}
Ejemplo n.º 27
0
void PLAYER::CollectPowerUp(enum POWERUP_TYPE type, int count)
{
	char* msg = new char[64];
	switch(type)
	{
	case pwrHealth:
		SetHealth(GetHealth() + count);
		sprintf(msg, "Health collected (+%u)\0", count);
		break;
	case pwrAmmo:
		SetAmmo(GetAmmo() + count);
		sprintf(msg, "Ammo collected (+%u)\0", count);
		break;
	case pwrScore:
		SetScore(GetScore() + count);
		sprintf(msg, "Score collected (+%u)\0", count);
		break;
	}

			
	gui->LogOnScreen(msg);
}
Ejemplo n.º 28
0
// Start game
void LoadInvaders()
{
	SetScore( 0 );

	for ( int i = 0; i < INVADER_ROW_COUNT; i++ )
	{
		int y = 100 + (i*50);
		int w = (i*4);
		int h = (i*4);

		for ( int j = 0; j < INVADER_ROW_POPULATION; j++ )
		{
			int x = 110 + (j*50) - (w/2);

			invaders[i][j].x = (float)x;
			invaders[i][j].y = (float)y;
			invaders[i][j].w = (float)24 + w;
			invaders[i][j].h = (float)24 + h;
			invaders[i][j].color = D3DCOLOR_XRGB( rand()%256, rand()%256, rand()%256 );
			invaders[i][j].alive = true;
		}
	}
}
Ejemplo n.º 29
0
// Follow spawner enemy
//------------------------------
FollowHub::FollowHub( const Vec2& position, bool powerA, bool powerB )
: Enemy( position, 14 )
, _timer( 0 )
, _dir( 0, 0 )
, _count( 0 )
, _powerA( powerA )
, _powerB( powerB )
{
    AddShape( new Polygram( Vec2(), 16, 4, 0x6666ffff, M_PI / M_FOUR, ENEMY | VULNERABLE ) );
    if ( _powerB ) {
        AddShape( new Polystar( Vec2( 16,  0 ), 8, 4, 0x6666ffff, M_PI / M_FOUR ) );
        AddShape( new Polystar( Vec2( -16, 0 ), 8, 4, 0x6666ffff, M_PI / M_FOUR ) );
        AddShape( new Polystar( Vec2( 0,  16 ), 8, 4, 0x6666ffff, M_PI / M_FOUR ) );
        AddShape( new Polystar( Vec2( 0, -16 ), 8, 4, 0x6666ffff, M_PI / M_FOUR ) );
    }
    AddShape( new Polygon( Vec2( 16,  0 ), 8, 4, 0x6666ffff, M_PI / M_FOUR ) );
    AddShape( new Polygon( Vec2( -16, 0 ), 8, 4, 0x6666ffff, M_PI / M_FOUR ) );
    AddShape( new Polygon( Vec2( 0,  16 ), 8, 4, 0x6666ffff, M_PI / M_FOUR ) );
    AddShape( new Polygon( Vec2( 0, -16 ), 8, 4, 0x6666ffff, M_PI / M_FOUR ) );
    SetScore( 50 + _powerA * 10 + _powerB * 10 );
    SetBoundingWidth( 16 );
    SetDestroySound( Lib::SOUND_PLAYER_DESTROY );
    SetEnemyValue( 6 + ( powerA ? 2 : 0 ) + ( powerB ? 2 : 0 ) );
}
Ejemplo n.º 30
0
// Shielder enemy
//------------------------------
Shielder::Shielder( const Vec2& position, bool power )
: Enemy( position, 16 )
, _dir( 0, 1 )
, _timer( 0 )
, _rotate( false )
, _rDir( false )
, _power( power )
{
    AddShape( new Polystar( Vec2(  24,  0 ), 8, 6, 0x006633ff, 0,            VULNSHIELD ) );
    AddShape( new Polystar( Vec2( -24,  0 ), 8, 6, 0x006633ff, 0,            VULNSHIELD ) );
    AddShape( new Polystar( Vec2( 0,   24 ), 8, 6, 0x006633ff, M_PI / M_TWO, VULNSHIELD ) );
    AddShape( new Polystar( Vec2( 0,  -24 ), 8, 6, 0x006633ff, M_PI / M_TWO, VULNSHIELD ) );
    AddShape( new Polygon ( Vec2(  24,  0 ), 8, 6, 0x33cc99ff, 0,            0 ) );
    AddShape( new Polygon ( Vec2( -24,  0 ), 8, 6, 0x33cc99ff, 0,            0 ) );
    AddShape( new Polygon ( Vec2( 0,   24 ), 8, 6, 0x33cc99ff, M_PI / M_TWO, 0 ) );
    AddShape( new Polygon ( Vec2( 0,  -24 ), 8, 6, 0x33cc99ff, M_PI / M_TWO, 0 ) );

    AddShape( new Polystar( Vec2( 0,    0 ), 24, 4,                      0x006633ff, 0, 0 ) );
    AddShape( new Polygon ( Vec2( 0,    0 ), 14, 8, power ? 0x33cc99ff : 0x006633ff, 0, ENEMY | VULNERABLE ) );
    SetScore( 60 + _power * 40 );
    SetBoundingWidth( 36 );
    SetDestroySound( Lib::SOUND_PLAYER_DESTROY );
    SetEnemyValue( 8 + ( power ? 2 : 0 ) );
}