• 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!

Grid problems that make no sense to me.

J

JordanTalley

Guest
I have a script that is run that keeps track of what entities are where in the room. The best way I can describe the problem is when I set things to the correct value they arent when I go back and check on them. I commented whats happening in the script below which describes it better than I am.

For reference the log script just collects as many arguments as you pass it and separated them with spaces and shows it as a debug message. The log_a_grid is described in the script:
Code:
///scanner();
ds_grid_clear(gen.grident,array(0,noone));
log_a_grid(gen.grident);
//This script prints out the first value in the array of each cell in the grid
//At this point every cell is a 0.
//Player, foe, and chest have no childeren and are the only childeren of entity.
with entity {
    var arr;
    arr[0] = 0;
    switch object_index {
        case player: arr[0]=5; break; //On this level there are 4
        case foe:    arr[0]=6; break; //On this level there is 1
        case chest:  arr[0]=7; break; //There is always 1
    }
    if arr[0]==0 log("Non-Indexed Entity: ",object_get_name(object_index));
    arr[1] = id;
    gen.grident[# gx,gy] = arr;
}
log_a_grid(gen.grident);
//Most cells are 0 but there are 6 cells that are 7.

Any idea whats going on?
 
Top