E
e1ketzu
Guest
Hi I am trying to build a hight table from an tileset wich is bigger than 1 row.
But whenever I try to set a second for loop in the draw event the game freezes.
I know my way is not the fastest without using buffers but it is just needed once at start.
My code so far:
Create Event:
Draw Event:
Here now is just the loop for the first row which is working perfect.
How in the world I get it to work with the following colums?
Thanks for any help.
But whenever I try to set a second for loop in the draw event the game freezes.
I know my way is not the fastest without using buffers but it is just needed once at start.
My code so far:
Create Event:
Code:
/// @description Game Setup
//Collision tiles
//Add all tiles to the screen
#macro TILE_SIZE 64
var k = 1; //Variable for Tile_data
tiles_x = sprite_get_width(sCol) / TILE_SIZE;
tiles_y = sprite_get_height(sCol) / TILE_SIZE;
heightstoget = tiles_x * TILE_SIZE;
rowstoget = tiles_y * TILE_SIZE;
//Make Tile layer
var layerid = layer_create(0,"Tiles");
tilemapid = layer_tilemap_create(layerid,0,0,tCollision,tiles_x,tiles_y);
//Create Tiles
var data
for (var j = 0; j <= tiles_y; j++)
{
for (var i = 0; i <= tiles_x; i++)
{
tilemap_set(tilemapid, k, i, j);
show_debug_message("Tile " + string(i) + " set");
k++;
}
}
Here now is just the loop for the first row which is working perfect.
Code:
/// @description Build height table then start game
{
draw_tilemap(tilemapid,0,0);
for (var i = heightstoget-1; i >= 0; i--)
{
var check = 0;
while (check <= (TILE_SIZE))
{
global.heights[i] = check;
if (check == TILE_SIZE) break;
if (surface_getpixel(application_surface,i,check) != c_black) break;
check++;
}
}
}
room_goto_next();
Thanks for any help.
Last edited by a moderator: