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

GameMaker [SOLVED]Need a little help with a ds_map

I have a map already set up and i am creating instances and setting the "name"

How can i set a numerical value for "number" using i in the loop as the value?


var size = ds_map_size(global.catlist);
var key = ds_map_find_first(global.catlist);

for (var i = 0; i < size; i++; ) {
with(instance_create_depth(x+24,y+(i*250),100,ob_Cat)) {
category = key;

}

key = ds_map_find_next(global.catlist,key);

}
 

Neptune

Member
If you explain what you're trying to do, we can probably help better.
I feel like something other than a ds_map would suite your needs.

Here is how to store/retrieve values using a ds_map:

Code:
var my_map = ds_map_create(); //CREATE MAP

my_map[? "my_name"] = "Vether"; //STORE A VALUE UNDER THE KEY "my_name"
my_map[? "my_age"] = 24; //STORE A VALUE UNDER THE KEY "my_age"

var name =    my_map[? "my_name"]; //RETRIEVE NAME
var age =    my_map[? "my_age"]; //RETRIEVE AGE

ds_map_destroy(my_map); //DESTROY THE MAP
 
Last edited:
Top