Fleoh
Member
Hello guys, I've got a question.
In Game maker, there is a way to adress an object from a string with the function asset_get_index.
Exemple :
Is there a way to do the same thing with a variable ?
Exemple :
I've tried a bunch of things and noone of them works...
Thanks for your help !
In Game maker, there is a way to adress an object from a string with the function asset_get_index.
Exemple :
Code:
weapon = "pistol";
sprite_index = asset_get_index("spr_"+ weapon);
Exemple :
Code:
sell_pistol = 50;
weapon = "pistol";
price = asset_get_index("sell_" + weapon);
Thanks for your help !