@@ -228,14 +228,14 @@ void setToasterSpawnCoordinates(struct Toaster *toaster, int screenWidth, int sc
228
228
int slotWidth = screenWidth / GRID_WIDTH ;
229
229
int slotHeight = screenHeight / GRID_HEIGHT ;
230
230
toaster -> x = screenHeight + (toaster -> slot % GRID_WIDTH ) * slotWidth + (slotWidth - SPRITE_SIZE ) / 2 ;
231
- toaster -> y = - screenHeight + (toaster -> slot / GRID_HEIGHT ) * slotHeight + (slotHeight - SPRITE_SIZE ) / 2 ;
231
+ toaster -> y = - screenHeight + (toaster -> slot / GRID_WIDTH ) * slotHeight + (slotHeight - SPRITE_SIZE ) / 2 ;
232
232
}
233
233
234
234
void setToastSpawnCoordinates (struct Toast * toast , int screenWidth , int screenHeight ) {
235
235
int slotWidth = screenWidth / GRID_WIDTH ;
236
236
int slotHeight = screenHeight / GRID_HEIGHT ;
237
237
toast -> x = screenHeight + (toast -> slot % GRID_WIDTH ) * slotWidth + (slotWidth - SPRITE_SIZE ) / 2 ;
238
- toast -> y = - screenHeight + (toast -> slot / GRID_HEIGHT ) * slotHeight + (slotHeight - SPRITE_SIZE ) / 2 ;
238
+ toast -> y = - screenHeight + (toast -> slot / GRID_WIDTH ) * slotHeight + (slotHeight - SPRITE_SIZE ) / 2 ;
239
239
}
240
240
241
241
void spawnToasters (struct Toaster * toasters , int screenWidth , int screenHeight , int * grid ) {
@@ -249,7 +249,7 @@ void spawnToasters(struct Toaster *toasters, int screenWidth, int screenHeight,
249
249
250
250
void spawnToasts (struct Toast * toasts , int screenWidth , int screenHeight , int * grid ) {
251
251
for (int i = 0 ; i < TOAST_COUNT ; i ++ ) {
252
- toasts [i ].slot = grid [TOASTER_COUNT + TOAST_COUNT - 1 - i ];
252
+ toasts [i ].slot = grid [TOASTER_COUNT + i ];
253
253
toasts [i ].moveDistance = 1 + rand () % MAX_TOAST_SPEED ;
254
254
setToastSpawnCoordinates (& toasts [i ], screenWidth , screenHeight );
255
255
}
0 commit comments