I've ran into some issues with my current gamemaker project. I've setup a simple "merge" functionality in my game, and I'm trying to increase it's QoL
So what's happening when I'm merging, is this;
var sabatons = instance_place(x, y, object_index);
if (instance_exists(sabatons)) {
instance_create_layer(sabatons.lastknownPosX, sabatons.lastknownPosY, "Instances", "");
if (level >= 3) {
scr_spawn_experience();
}
audio_play_sound(snd_sabatons_merge,10,false);
instance_destroy();
instance_destroy(sabatons);
}
So what the code above does, is to check if object_index
matches with what I'm trying to merge it with, and if it does, it runs instance_create_layer
- which is where my question comes in.
My objects are easily named with a digit at the end, to keep track of their "level"
so basically, obj_sabatons_1
means it's the first item in a chain, obj_sabatons_2
is the second etc. Now what I need help with is to convert whatever the object is that I'm trying to merge with, to a string (object_index) but increase it with 1, so I then can put that result in my instance_create_layer
so the game will create the next level of item, if I successfully merge my first two items :)
Thanks!!