Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rommmmaha committed Jun 7, 2024
1 parent 2467c7e commit 0b41997
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
17 changes: 12 additions & 5 deletions client/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
game::game()
{
srand(unsigned int(time(NULL)));

fps = 10;
scale = 20;
debug = false;
running = true;
needInitialization = true;
number_of_enemies = 2;

map = nullptr;
tmp_map = nullptr;
Expand Down Expand Up @@ -45,6 +40,14 @@ void game::clear()

void game::init()
{

if (firstStart)
{
fps = 10;
scale = 20;
debug = false;
number_of_enemies = 2;
}
// Preparing
clear();
needInitialization = false;
Expand Down Expand Up @@ -154,6 +157,7 @@ void game::update()
}
break;
case sf::Keyboard::R:
firstStart = true;
needInitialization = true;
return;
case sf::Keyboard::D:
Expand Down Expand Up @@ -219,6 +223,7 @@ void game::update()
// Check if player is on path
if (map[pos2index(player.x, player.y, map_size.x)] == 2)
{
damaged.play();
needInitialization = true;
return;
}
Expand Down Expand Up @@ -349,6 +354,8 @@ void game::update()

void game::draw()
{
if (!running)
return;
// - Render Start

// Background
Expand Down
1 change: 1 addition & 0 deletions client/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ int main()
_game.update();
_game.draw();
}
_game.clear();
return 0;
}
int WinMain()
Expand Down

0 comments on commit 0b41997

Please sign in to comment.