Update render.c

This commit is contained in:
Jason Bou-Samra
2024-08-30 19:23:55 +10:00
committed by GitHub
parent c270cf02f9
commit f02ef70f39
+8 -10
View File
@@ -240,18 +240,16 @@ int display_grid() {
//////////////// GAME LOGIC //////////////// //////////////// GAME LOGIC ////////////////
int game_logic(void) { int game_logic(void) {
// new_brick();
count_col();
printf("colcnt[%i]: %i, row: %i\n", col, colcnt[col], row); printf("colcnt[%i]: %i, row: %i\n", col, colcnt[col], row);
disp_column (row, col); disp_column (row, col); // update column in grid
grid[0][row - 2][col] = 0; count_col(); // count number of empty spaces in each column
if(row == colcnt[col]) { if(row == colcnt[col]) {
row = 0; row = -1;
for (int i = 0; i < 3; i++) {
tile_current[i] = tile_next[i];
}
new_brick();
col = new_column(); col = new_column();
// next column preview here
new_brick();
} else if (row == 16) {
row = 0;
} }
row++; row++;
} }
@@ -279,7 +277,7 @@ int Ren_game(void) {
{ {
current_time = SDL_GetTicks(); current_time = SDL_GetTicks();
deltatime = current_time - last_time; deltatime = current_time - last_time;
if (deltatime > 200) { if (deltatime > 500) {
last_time = current_time; last_time = current_time;
deltatime = 0; deltatime = 0;
game_logic(); game_logic();