AnotherHero
Member
Hiya all!
I'm making a sudoku game. The player can only see one block of the 3x3 grid at a time. The way I draw the numbers looks like this:
(the "scene" is the block of the grid the player is viewing)
This works fine when drawing the top left block, as seen:
I want the player to be able to view any one of the blocks. The full puzzle is only there in the bottom right for debug purposes. The problem is, when I have _x and _y offset for, say, 4-7 instead of 0-3, to get the center block, the numbers are drawn offset so much they are off screen.
I know it's because _x and _y not only multiply the number positions, but it's also used as the locator to find out which numbers to draw. I've tried using four nested for loops and just changing what sudoku.givens[i,j] we're looking for, but it causes every digit, 0-9, to draw in every tile.
If anybody needs more clarification or code, I'm happy to provide.
Thank you
I'm making a sudoku game. The player can only see one block of the 3x3 grid at a time. The way I draw the numbers looks like this:
GML:
switch scene {
case 1:
for (var _x = 0; _x < 3; ++_x) {
for (var _y = 0; _y < 3; ++_y) {
if (sudoku.givens[_x,_y] == 0) continue;
draw_text((map_width / 3 * _x) + (screen_center_x) - (map_width / 3),(map_width / 3 * _y) + (screen_center_y) - (map_width / 3), string(sudoku.givens[_x,_y]));
}
}
break;
(the "scene" is the block of the grid the player is viewing)
This works fine when drawing the top left block, as seen:
I want the player to be able to view any one of the blocks. The full puzzle is only there in the bottom right for debug purposes. The problem is, when I have _x and _y offset for, say, 4-7 instead of 0-3, to get the center block, the numbers are drawn offset so much they are off screen.
I know it's because _x and _y not only multiply the number positions, but it's also used as the locator to find out which numbers to draw. I've tried using four nested for loops and just changing what sudoku.givens[i,j] we're looking for, but it causes every digit, 0-9, to draw in every tile.
If anybody needs more clarification or code, I'm happy to provide.
Thank you
Last edited: