Skip to content
Snippets Groups Projects
Commit 65ea627e authored by sgupta72's avatar sgupta72
Browse files

Fixed minor thing

parent 152a12f3
Branches master
No related tags found
No related merge requests found
......@@ -39,9 +39,8 @@ void Game::GameLoop(string filename)
vector<Rect *> bitcoins;
Rect *exit = NULL;
//load the file
while(!in.eof())
while((in >> entity_x >> entity_y >> type))
{
in >> entity_x >> entity_y >> type;
if(type == 0)
{
entities.push_back(new Platform(window, entity_x, entity_y));
......@@ -62,6 +61,7 @@ void Game::GameLoop(string filename)
bitcoins.push_back(bitcoin);
}
}
cout << "Number of bitcoins: " << bitcoins.size() << endl;
//while the quit button hasn't been pressed
while(!quit)
{
......@@ -105,9 +105,9 @@ void Game::GameLoop(string filename)
SDL_Rect cur_bitcoin_rect = bitcoins[i]->get_rect();
if(SDL_HasIntersection(&player_rect, &cur_bitcoin_rect))
{
collected = true;
collected++;
bitcoins.erase(bitcoins.begin() + i);
i--;
break;
}
}
//clear window
......
......@@ -62,7 +62,7 @@ int main()
if(level != -1)
{
SDL_Delay(100);
Game *game = new Game("level.txt");
Game *game = new Game(level_files[level]);
delete game;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment