make tetromino spawn in the centre

This commit is contained in:
2025-01-29 17:20:11 +01:00
parent 6115160095
commit 48117451cd
2 changed files with 2 additions and 2 deletions

View File

@@ -29,7 +29,7 @@ void game_init(GameData* const game_data) {
srand(time(NULL));
set_next_shape(game_data);
game_data->selected = (SelectedShape){game_data->next_shape, 0, 0};
game_data->selected = (SelectedShape){game_data->next_shape, COLUMNS / 2 - SHAPE_WIDTH / 2, 0};
set_next_shape(game_data);
}

View File

@@ -93,7 +93,7 @@ void place_update(GameData* const game_data, const InputData move) {
set_shape(game_data->row, selected->id, selected->x, selected->y); // if the shape intersects vertically, write the shape at the current position and return
clear_rows(game_data->row); // clear the rows that have been completed
game_data->selected = (SelectedShape){game_data->next_shape, 0, 0};
game_data->selected = (SelectedShape){game_data->next_shape, COLUMNS / 2 - SHAPE_WIDTH / 2, 0};
set_next_shape(game_data);
return;
}