예제 #1
0
void ScenarioDefend::Update(double dt, bool multiplay)
{
	this->multiplay = multiplay;
	if (timer.GetTimeLeft() > 0){
		if (Enemy::enemyList.size() <= 0){//check for wave completion
			wave++;
			amountToSpawn += increment;

			SpawnEnemies();
			MoveEnemies();
		}
	}
	if (Enemy::enemyList.size() > 0){
		for (vector<Enemy*>::iterator it = Enemy::enemyList.begin(); it != Enemy::enemyList.end();){//check if enemies reached destination
			if ((*it)->reachedDestination){
				HP -= 1;
				if (HP <= 0){// LOSE
					stopScenario = true;
				}

				delete *it;
				it = Enemy::enemyList.erase(it);
			}
			else{
				it++;
			}
		}
	}
	if (timer.GetTimeLeft() <= 0 && Enemy::enemyList.size() <= 0){// WIN
		winScenario = true;
		stopScenario = true;
	}
}
예제 #2
0
파일: world.cpp 프로젝트: iborsch/Labs
bool World::PredictWorld(const Action& action) {
	if (data_points_.empty() || enemies_.empty()) {
		return true;
	}
	auto closest_data_points = MoveEnemies();
	if (!PerfromHeroAction(action)) {
		return false;
	};
	CollectData(closest_data_points);
	return true;
}
예제 #3
0
ScenarioDefend::ScenarioDefend(int health, double duration, int increment, bool multiplay)
{

	this->increment = increment;
	amountToSpawn = increment;
	HP = health;
	wave = 1;
	winScenario = false;
	timer.StartCountdown(duration);
	this->multiplay = multiplay;

	SpawnEnemies();
	MoveEnemies();
}
예제 #4
0
void UpdateGameState(float deltaTime) {

	player.Move(deltaTime, SPEED);
	MoveEnemies(deltaTime);

	//draw sprites
	DrawSprite(player.iSpriteID);

	for (int i = 0; i < enemyArr1Length; i++) {
		for (int j = 0; j < enemyArr2Length; j++) {
			DrawSprite(alienShips[i][j].iSpriteID);
		}
	}

	DrawLine(0, 40, iScreenWidth, 40, SColour(0x00, 0xFC, 0x00, 0xFF)); //doesn't acctually draw anything?

	//drawstrings
	SetFont(pInvadersFont);
	DrawString("SCORE < 1 >", iScreenWidth * 0.025f, iScreenHeight - 2);
	DrawString("0000", iScreenWidth * 0.11f, iScreenHeight - 32);
	DrawString("HI-SCORE", iScreenWidth * 0.35f, iScreenHeight - 2);
	DrawString("0020", iScreenWidth * (0.05f + 0.35f), iScreenHeight - 32);
	DrawString("SCORE < 2 >", iScreenWidth * 0.65f, iScreenHeight - 2);
}
예제 #5
0
void UpdateGameState(float deltaTime) {
	player.Fire(buttonDown);
	player.Move(deltaTime, 300.f);
	MoveEnemies(deltaTime);
	
}