uint32_t TriMesh::FetchIndex( uint32_t inStartOffset, int inBytes ) { uint32_t result = 0; if (inBytes == 1) { result = Boss()->FetchUInt8( inStartOffset ); if (result == 0xFF) { result = 0xFFFFFFFFUL; } } else if (inBytes == 2) { if (result == 0xFFFF) { result = 0xFFFFFFFFUL; } result = Boss()->FetchUInt16( inStartOffset ); } else { result = FetchUInt32( inStartOffset ); } return result; }
Room::Room() { Boss endBoss = Boss(10); RandomGenerator rg = RandomGenerator(); size = RoomSize[rg.getRandom(0, 2)]; content = RoomContent[rg.getRandom(0, 3)]; description = RoomDescription[rg.getRandom(0, 3)]; appearance = RoomAppearance[rg.getRandom(0, 3)]; lighting = RoomLighting[rg.getRandom(0,3)]; connected[RoomDirection::NORTH] = nullptr; connected[RoomDirection::EAST] = nullptr; connected[RoomDirection::SOUTH] = nullptr; connected[RoomDirection::WEST] = nullptr; visited = false; visiting = false; exit = false; equipment.push_back(Equipment()); }
void EnemyManager::Update(sf::Vector2f p_playerPos, float p_dt, sf::Vector2f p_screenDimensions) { ManageEnemySpawning(p_screenDimensions, p_playerPos, p_dt); for (int i = 0; i < m_enemyList.size(); i++) { if (m_enemyList.at(i)->CheckOffScreen(p_screenDimensions)) { m_enemyList.at(i)->RemoveVars(); m_enemyList.erase(m_enemyList.begin() + i); } } for (int i = 0; i < m_enemyList.size(); i++) { m_enemyList.at(i)->Update(p_playerPos, p_dt); if (m_enemyList.at(i)->UpdateAnim(p_dt) == false) { m_enemyList.at(i)->RemoveVars(); m_enemyList.erase(m_enemyList.begin() + i); } } if (m_waveCounter == 0) // if in the boss mode { for (int i = 0; i < m_boss.GetTowerList()->size(); i++) { if (m_boss.GetTowerList()->at(i).UpdateAnim(p_dt) == false) m_boss.GetTowerList()->erase(m_boss.GetTowerList()->begin() + i); } m_boss.Update(p_playerPos, p_dt); if (m_boss.CheckIfDefeated()) { m_waveCounter = 5; m_boss = Boss(m_textureAtlas, m_BOSS_COORDS); } } }
Room::Room(int room) { number = room; Boss endBoss = Boss(10); RandomGenerator rg; size = RoomSize[rg.getRandom(0, 2)]; content = RoomContent[rg.getRandom(0, 3)]; description = RoomDescription[rg.getRandom(0, 3)]; appearance = RoomAppearance[rg.getRandom(0, 3)]; lighting = RoomLighting[rg.getRandom(0, 3)]; color = RoomColor[rg.getRandom(0, 3)]; connected[RoomDirection::NORTH] = nullptr; connected[RoomDirection::EAST] = nullptr; connected[RoomDirection::SOUTH] = nullptr; connected[RoomDirection::WEST] = nullptr; visited = false; visiting = false; exit = false; equipment.push_back(Equipment()); if (rg.getRandom(0, 100) < 20) traps.push_back(Trap()); }
// NOTE: In C++, declaring "Object instance;" will instantly call the Object constructor! // To do these forward declarations, use smart pointers (unique_ptr) instead. Character character = Character(); std::vector<Enemy> enemies = {}; std::vector<Projectile> projectiles = {}; std::vector<Mesh >meshes = {}; int glutElapsedTime = 0; //in ms bool keyPressed[256]; //keyboard buffer unique_ptr<Background> background; //smart pointer needed unique_ptr<Groundfloor> groundfloor; std::vector<Ridge> mountains; int numberOfRidges = 2; bool toggleBoss = false; Boss boss = Boss(Vec3Df(8, -1, -2), -1, 0.5);; // Game timing constants (in ms) const int firstEnemySpawnDelay = 3000; const int enemyRespawnDelay = 1500; const int bossSpawnDelay = 30000; //TODO remove this again int meshIndex = 0; //Phong model properties float is = 1.0f; float id = 1.0f; float ia = 0.1f; float ks = 1.0f;
void Room::setExit(int lvl) { exit = true; enemys.push_back(Boss(lvl)); }
Boss * Boss::create(const BossConfig * pConfig) { Boss * ret = NEW Boss(pConfig); ret->autorelease(); return ret; }
void EnemyManager::Init(sf::Texture& p_tex) { m_textureAtlas = &p_tex; m_boss = Boss(m_textureAtlas, m_BOSS_COORDS); }