I'm using GM2, following a tutorial that was made for GM1. I've run into a few little differences already, but I'm stumped on what's going on here. I've got 2 objects right now. The first is a node object that acts as the tiles that comprise the game map. The nodes aren't placed themselves, though - instead, they're placed in the create code of my second object, obj_game, which acts as a sort of controller object:
GRID_SIZE is defined as a macro in a script file and I've got debug text running that proves that mapWidth and mapHeight aren't 0, so the loop ought to be iterating. But without fail, I don't see any of my obj_nodes being created, even though they ought to be covering most of the screen.
I've tried manually placing obj_nodes into the room, and that works just fine. And my background has a depth of 100, so it shouldn't be obscuring anything.
Here's the draw code for my obj_nodes:
Removed youtube link to see if that will skip the approval process. Didn't realize how long it'd take. It's Sergeant Indie's Turn-based Strategy 101, episode 1, Creating a Game Grid. Around 11 minutes in is the most relevant part, although I don't know if it's really necessary to see that anyway.
And lastly, here's an image of what's being displayed:
The blue circle is just a sprite I added to confirm my obj_game was there. The text is the map width/height. And the white square with 0 in it is my obj_node, which should be tiling over the entire screen but isn't.
GML:
globalvar map;
mapWidth = room_width/GRID_SIZE;
mapHeight = room_height/GRID_SIZE;
for (xx = 0; xx << mapWidth; xx += 1) {
for (yy = 0; yy << mapHeight; yy += 1) {
map[xx,yy] = instance_create_depth(xx * GRID_SIZE, yy * GRID_SIZE, 0, obj_node);
}
}
I've tried manually placing obj_nodes into the room, and that works just fine. And my background has a depth of 100, so it shouldn't be obscuring anything.
Here's the draw code for my obj_nodes:
GML:
draw_self();
draw_set_color(c_black);
draw_text(x+4, y+4, string(ds_list_size(neighbors)));
draw_set_color(c_white);
And lastly, here's an image of what's being displayed:
The blue circle is just a sprite I added to confirm my obj_game was there. The text is the map width/height. And the white square with 0 in it is my obj_node, which should be tiling over the entire screen but isn't.
Last edited: