• 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 asset_get_index() across platforms

J

JulianS

Guest
Very simple and straightforward question:

How good does asset_get_index() work across all platforms?
(especially when dealing with sprite- and scriptnames)

Because I am using it as a very important part in the Engine of the Game I am creating, and I read about problems in HTML5 in combination with scripts, which didn't occur for me, but made me wonder nonetheless.
I am happy about any experiences you got with this, even if it is only for one platform!
 
J

JulianS

Guest

chamaeleon

Member
Yes, I read this but the problems with HTML5 described on that page didn't occur for me,
so I was wondering if it is up to date, which was the reason I started this thread:
To get user input from people working on a different platform, as I strive to release my game for some of these platforms one day.
If you encounter the problem and you still need to use an equivalent to asset_get_index() you could solve it using a manually created lookup table.
Code:
script_map = ds_map_create();
script_map[? "script1"] = script1;
script_map[? "script2"] = script2;

var the_script = "script1"; // as an example, could come from whatever source makes sense
script_execute(script_map[? the_script], param1, param2, ...);
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
This functionality appears to be working as intended as of the current version of GMS2 in HTML5 - I filed a bug but you're very likely good to use these across all targets
 
Top