|
|
|
@ -7,6 +7,7 @@
|
|
|
|
|
#include <SFML/System/Vector2.hpp>
|
|
|
|
|
#include <SFML/Window/Keyboard.hpp>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <iterator>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
#define WINDOW_WIDTH 280
|
|
|
|
@ -303,6 +304,15 @@ int main()
|
|
|
|
|
|
|
|
|
|
// Landing (transfering block to grid and reinitializing)
|
|
|
|
|
if (landed) {
|
|
|
|
|
if (block.position.y == 0) {
|
|
|
|
|
score = 0;
|
|
|
|
|
text.setString("0");
|
|
|
|
|
for (int y = 0; y < GRID_HEIGHT; y++) {
|
|
|
|
|
for (int x = 0; x < GRID_WIDTH; x++) {
|
|
|
|
|
grid[y][x] = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
for (auto tile : block.get_tiles()) {
|
|
|
|
|
grid[tile.y][tile.x] = block.type->tile_type;
|
|
|
|
|
}
|
|
|
|
@ -326,6 +336,7 @@ int main()
|
|
|
|
|
score++;
|
|
|
|
|
text.setString(std::to_string(score));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
block = Block();
|
|
|
|
|
} else if(is_update_frame) {
|
|
|
|
|
block.position.y++;
|
|
|
|
|