PlatKillas::PlatKillas() { Init(); done = false; lastFrameTicks = 0.0f; timeLeftOver = 0.0f; gravity_x = 0.0f; gravity_y = -9.8f; bulletIndex = 0; shootTimer = 0.1f; buildLevel(); characterSpriteSheetTexture = LoadTexture("characters_1.png"); SheetSprite playerSprite = SheetSprite(characterSpriteSheetTexture, 12, 8, 15); player = new Player(); player->sprite = playerSprite; player->y = -0.5f; player->width = 0.2f; player->height = 0.2f; player->friction_x = 3.0f; entities.push_back(player); }
const IntervalRTreeNode * SortedPackedIntervalRTree::buildTree() { // sort the leaf nodes std::sort( leaves->begin(), leaves->end(), IntervalRTreeNode::compare ); // now group nodes into blocks of two and build tree up recursively IntervalRTreeNode::ConstVect * src = leaves; IntervalRTreeNode::ConstVect * dest = new IntervalRTreeNode::ConstVect(); while (true) { buildLevel( src, dest); if (dest->size() == 1) { const IntervalRTreeNode * r = (*dest)[ 0 ]; delete src; delete dest; //delete leaves; // don't need anymore return r; } IntervalRTreeNode::ConstVect * temp = src; src = dest; dest = temp; } }
void GameState::nextLevel() { resetBall(); ++m_level; buildLevel(); }
int Play::play() { //physicsMap(levelMap); buildLevel(); Game game; int success = game.run(); return success; }
void Level::read() { float width, height; width = (float)std::stoi(nextWord()); height = (float)std::stoi(nextWord()); m_sizeLevel = sf::Vector2f(width,height); buildLevel(); }
void ClassDemoApp::Render() { viewMatrix.identity(); buildLevel(); renderTilemap(); viewMatrix.Translate(-player->position_x, -player->position_y - 1.0f, 0); player->Draw(program); }
GameState::GameState(difficulty d) { m_difficulty = d; m_level = 0; m_balls = 3; m_blocks_destroyed = 0; m_paddle = 0; resetBall(); buildLevel(); initializeGL(); g_sound_engine.playSound(NEW_GAME); }
void SideScroller::Init() { // insert player as the first entity SpriteSheet playerSprite = SpriteSheet(characterSpriteSheetTexture, 12, 8, 18); Entity* player = new Entity(); player->sprite = playerSprite; player->x = 0.0f; player->y = -2.5f; player->width = 0.2f; player->height = 0.2f; player->friction_x = 3.0f; player->isPlayer = true; entities.push_back(player); // build the level, aka read tile file and throw into leveldata buildLevel(); }
void ObjectOverviewModel::buildData(IOManager* io, std::string rootDir) { auto dataRoot_ = new DataFolder(model_, owner_); auto root = addTopLevelData(dataRoot_); auto tplDir = io->findFolder(rootDir, "templates"); if(tplDir.empty()) { std::cout << "templates not found? this wasn't supposed to happen" << std::endl; } else buildTemplates(io, tplDir, root); auto lvlDir = io->findFolder(rootDir, "level"); if(lvlDir.empty()) { std::cout << "level not found? this wasn't supposed to happen" << std::endl; } else buildLevel(io, lvlDir, root); auto asDir = io->findFolder(rootDir, "angelscript"); if(asDir.empty()) { std::cout << "angelscript not found? this wasn't supposed to happen" << std::endl; } else buildAS(io, asDir, root); }
void ObjectOverviewModel::buildLevel(IOManager* io, std::string rootDir, QTreeWidgetItem* root, std::string name, LevelFolder* lvlFolder) { auto levelRoot_ = new LevelFolder(rootDir, name, model_, lvlFolder, owner_); auto lvlRoot = addChild(root,levelRoot_); levelRoot_->setTreeItems(lvlRoot); auto levels = io->getAllDataInDirectory(rootDir, ".lvl"); for (auto &t : levels) { auto lvlItem = new LevelResource(t, rootDir, model_, levelRoot_, owner_); auto treeItem = addChild(lvlRoot, lvlItem); auto lvl = model_.levelEditorModel()->loadLevel(io->findResource(rootDir, t), lvlItem->name()); if(lvl) { lvl->setLevelResource(lvlItem); lvlItem->setTreeItems(lvlRoot, treeItem); } } auto sub = io->getAllFoldersInDirectory(rootDir); for (int i = 0; i < sub.size(); i++) { buildLevel(io, rootDir+sub[i]+"/", lvlRoot, sub[i], levelRoot_); } }