C
Carcophan
Guest
Hello everyone.
I have a script that successfully generates a random map using ds_grid_create. Additionally, the mp_grid_draw(global.gridPathing) works as expected, showing proper pathing, etc.
I can move around, collision works well. However, when I go to inspect any of the individual tile elements with RMouse pop up messages, I am getting -1 or undefined values returned on screen.
I know I am doing something that is overly simple wrong, was hoping for an extra set of eyes. Searching for 'undefined' doesn't really yield much valid content. I keep experimenting with different concepts and ideas I see online but nothing seems to help.
The current code is more example than anything, used in an attempt to debug, not all the code is shown above.
So MX and the tileindexofMouse that is fed by mx are both returning -1's.
Thoughts?
Thanks in advance.
I have a script that successfully generates a random map using ds_grid_create. Additionally, the mp_grid_draw(global.gridPathing) works as expected, showing proper pathing, etc.
I can move around, collision works well. However, when I go to inspect any of the individual tile elements with RMouse pop up messages, I am getting -1 or undefined values returned on screen.
I know I am doing something that is overly simple wrong, was hoping for an extra set of eyes. Searching for 'undefined' doesn't really yield much valid content. I keep experimenting with different concepts and ideas I see online but nothing seems to help.
These are triggered from a mouse click event within a player step object. The grids are generated in the create event in a level object.var mx = tilemap_get_at_pixel(global.map_id, mouse_x, mouse_y);
var my = tilemap_get_at_pixel(global.map_id, mouse_x, mouse_y);
var IndexMouse = tilemap_get(global.map_id, mx, my); //displays as -1
//i've replaced the map_id with cell and cellFill for fun, but neither worked, just in case.
//also as a debug message, these show undefined.
var tester1 = global.cell[# mouse_x, mouse_y]; //displays as undefined
var tester2 = global.cellFill[# mouse_x, mouse_y]; //displays as undefined
global.lay_id = layer_get_id("BGTiles");
global.map_id = layer_tilemap_get_id(global.lay_id); //cell/cellFill
global.map_id = ds_grid_create(mazeWidth, mazeHeight);
ds_grid_set_region(global.map_id, 0, 0, mazeWidth, mazeHeight, 1);
The current code is more example than anything, used in an attempt to debug, not all the code is shown above.
Code:
show_message(string(tester1) + " and " + string(tester2) + " and AA = " + string(outVal11) + " and BB = " + string(outVal22)
+ " CX: " + string(cx) + " & MX: " + string(mx) + " & Mouse Index: " + string(tileIndexOfMouse)
+ " & CharIndex: " + string(tileIndexOfChar) + " & Step Loc: " + string(charStepLoc))
Thoughts?
Thanks in advance.
Last edited by a moderator: