I've decided code my own small library since I just need basic functionallity and only instance,asset and background layers. Seems to be working fine so far, but you have helped a lot with your implementation so thanks a lot!
dreamsknight
Recent community posts
Thanks for the reply, glad to hear that it's planned!
I have many layers in my game (150+) , and layers I need to load from another room have varrying depths, I don't wanna set the depth of the layers in external rooms as it will make it hard to make changes. IE if I add a new layer into my main room, now depth changes for all layers and I need to change it in all rooms etc. I also have code that operates on the layer names directly.
Hello, how do I make it so that it uses existing layers instead of creating a new one?
function __roomloader_create_layer(_data) {
var _existing_layer = layer_get_id(_data.name);
var _layer = _existing_layer > -1 ? _existing_layer : layer_create(_data.depth, _data.name);
layer_set_visible(_layer, _data.visible);
layer_x(_layer, _data.xoffset);
layer_y(_layer, _data.yoffset);
layer_hspeed(_layer, _data.hspeed);
layer_vspeed(_layer, _data.vspeed);
return _layer;
}
I modified this function like this but doesn't seem to work, thanks
Ok the error is gone and it kinda works now, but it loads the variables on wrong instances.
The saving seems fine, but it loads the variables on random instances of the parent object.I believe I am doing something wrong, where exactly am I supposed to put that code?I put them on a parent object, as the it didn't work in the create event of a controller object.(I use the *variables* tab on objects in the room editor to assign some of them names as *secret_boss_room*, I haven't tried the creation code maybe it works better I will try it today)
Edit: Ok when I assign the variables through creation code it works just fine!It is the PreCreate/variable definition event that doesn't seem to work.Now that I think about it, I am not even sure if it is supposed to work with those.I am more than happy with creation code, just leaving this here in case it is a bug and you may want to fix it in the future.
Hello, I purchased the asset recently and everything is working fine except loading instance creation codes/variables.I used the txr2 method as per doc and I think it is saving the information right: { "name": "level0entrance", "creationCode": "unlocked = true;\r\n", "x": 1152, "y": 480, "obj": "par_room", "propertyCode": "special_room_name = \"starting_room\";\r\n" }, But when I try to load a room I get this error : ds_map_copy argument 2 incorrect type (string) expecting a Number (YYGI32) at gml_Script_txr_thread_create (line 19) - ds_map_copy(locals, argd); ############################################################################################ gml_Script_txr_thread_create (line 19) gml_Script_txr_exec (line 6) - var th/*:txr_thread*/ = txr_thread_create(arr, argd); gml_Script_room_pack_raw_run_cc (line 116) - room_pack_eval_script(l_ccRaw, l_ccPath); gml_Script_room_pack_raw_run_yy_inst_cc (line 140) - if (l_rcc != undefined && l_rcc != "") room_pack_raw_run_cc(l_rcc, l_rname + ":Properties"); gml_Script_room_pack_raw_add_layer (line 275) - room_pack_raw_run_yy_inst_cc(self, l_qinst); gml_Script_room_pack_raw_run_impl2 (line 339) - room_pack_raw_add_layer(l_lrs[|l_lrk]); gml_Script_room_pack_load_map (line 64) - room_pack_raw_run_impl2(l_map); gml_Script_room_pack_load_string (line 86) - room_pack_load_map(l_raw1, l_x, l_y, l_flags); gml_Script_room_pack_load_file (line 104) - var l_z = room_pack_load_string(buffer_read(l_buf, buffer_string), l_x, l_y, l_flags); gml_Object_obj_generate_level0_Alarm_0 (line 3) - room_pack_load_file("TestRoom.json"); I really need to save instance creation code, is there a working way?Or am I doing it wrong? Thanks