Storm1208
Member
Hey all! I've been working on some grid creation code and I ran into an issue with it last night. I've been trying to fix it for the past day but I haven't had any luck.
The code is supposed to generate a 5x8 size grid within the screen (not based on the room's height and width, but within a section of the room itself). Here's a look at the code from my grid objects draw event:
(obj_gridorigin is an object physically placed in the room to track the origin point (top-left corner) of the grid itself)
I ran this code using GameMaker's debugger and the "i" value of both loops hits every position it's supposed to, but for some reason not all the lines get printed. Here's a picture of what this code generates in-game:
I've tried looking up other threads and debugging my code but I can't figure out why some of the row and column lines just aren't printing. I'd appreciate some insight!
The code is supposed to generate a 5x8 size grid within the screen (not based on the room's height and width, but within a section of the room itself). Here's a look at the code from my grid objects draw event:
GML:
//drawing columns
for(var i = obj_gridorigin.x; i < obj_gridorigin.x + (grid_width * (col + 1)); i += grid_width){
draw_line_width(i, obj_gridorigin.y, i, obj_gridorigin.y + (grid_height * row), line_width);
}
//drawing rows
for(var i = obj_gridorigin.y; i < obj_gridorigin.y + (grid_width * (row + 1)); i += grid_height){
draw_line_width(obj_gridorigin.x, i, obj_gridorigin.x + (grid_width * col), i, line_width);
}
I ran this code using GameMaker's debugger and the "i" value of both loops hits every position it's supposed to, but for some reason not all the lines get printed. Here's a picture of what this code generates in-game:
I've tried looking up other threads and debugging my code but I can't figure out why some of the row and column lines just aren't printing. I'd appreciate some insight!