NeoShade
Member
Hoping somebody can help me out with something, because I think I'm going crazy over here.
I have the following code in the create event of an object:
I also have the room restarting when I press the enter key. Other than that, the entire project is completely blank. The room is the default size for GMS2 (1024 * 768) and the tileset size is 16x16, so max_height == 48.
The problem that I'm having is that the irandom results are all in the lower half of the range (0-28ish).
I can't understand why this is happening, and I'm hoping somebody can shed some light on it for me.
I have the following code in the create event of an object:
Code:
randomize();
var lay_id = layer_get_id("Tiles");
var map_id = layer_tilemap_get_id(lay_id);
var max_height = tilemap_get_height(map_id);
tilemap_clear(map_id, 0);
var ymax = 0;
for (var ix = 0; ix < tilemap_get_width(map_id); ++ix) {
for (var iy = 0; iy < irandom(max_height); ++iy) {
tilemap_set(map_id, 2, ix, iy);
ymax = max(ymax, iy);
}
}
show_debug_message(ymax);
The problem that I'm having is that the irandom results are all in the lower half of the range (0-28ish).
I can't understand why this is happening, and I'm hoping somebody can shed some light on it for me.