• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Mac OSX SLOPE COLLISIONS FATAL ERROR!

B

bilouw

Guest
Hey,

I made the Shaun tutorial for slope tiling in gamemaker 2. Everything was working fine, but then i had a very strange bug. It apperead only with one type of slope (slope on two tiles), and only in few rooms ... the bug is :

DoSub :1 : illegal array use
at gml_Script_Check_tilemap_collision(line 19) - return ((_y mod TILE_SIZE) - pixel);

None of these variables are array, so i don't understand this error ... Also, i don't understand why the error happen so randomly. The slopes works fine and 1 slope on 10 crash with this error.

Please guys help me, i'm so tired with this error because i really don't understand it...

Thanks.

EDIT :
var pixel = global.heights[(_x mod TILE_SIZE) + (pos * TILE_SIZE)];

It seems that GM consider the "pixel" variable like an array the step when the error appeared. I don't know why GM consider this varable like an array when i'm on this slope ...

EDIT 2:

I debug the value of "(_x mod TILE_SIZE) + (pos * TILE_SIZE)" to look where i go in my array. Just before crash the index value was "4294967299" so that is why the game crash. I try to found a value in array that doesn't exist. But now, i don't know why this number appear suddenly ...

EDIT 3 :

Ok so i've identified the problem. It come from the "pos" variable, and more precisely from this line of code : tilemap_get_at_pixel(tilemap, _x, _y). I don't know why, the function return "0, 1, 2, 3" in function of the tile i am (the index of the tile), but just before the error, the function return "268435456". And that is why the error occurs. Now, i really don't know why this function return this number so randomly in the room ...

FINAL EDIT (SOLVED) : OK i solved my problem. The problem was that i used the tilemap_get_at_pixel function ans this function return the id of the tile OR a blob of data. The error appeared when a blob of data was sent with this function. To resolve this, use tile_get_index(tilemap_get_at_pixel()) function to extract just the index of the tilemap. Now i don't have this issue anymore!
 
Last edited by a moderator:
Top