E
Erutan Egaro
Guest
Hello, I am currently working on a side scroller "army vs army" in the same branch as the "Commando Assault" series, but with a bit more control over your troops, and covers to create a trench-like combat style.
For this purpose I wanted to make the player able to designate certain covers as "check points", where the troops would stay stationed, to defend a position or to wait the order to charge.
Those points would be created by a simple left mouse's click on a selected cover, and a sprite of a flag (or something else later, I'm not really thinking about the sprites yet) would pop on the current cover deisgnated as "checkpoint". This works, except for one part.
I haven't been able to make the flag disappears in any way when the cover is not designated as the "checkpoint" anymore. Here is the code of the "cover" object, in the "left mouse pressed" event:
As you can see, I've tried to toy around with the layer_sprite_destroy fonction, to make the precedent sprite disappear before the new one is created ("la_flag_sprite" is the layer's name)
Anyone has an answer? Thank you in advance
For this purpose I wanted to make the player able to designate certain covers as "check points", where the troops would stay stationed, to defend a position or to wait the order to charge.
Those points would be created by a simple left mouse's click on a selected cover, and a sprite of a flag (or something else later, I'm not really thinking about the sprites yet) would pop on the current cover deisgnated as "checkpoint". This works, except for one part.
I haven't been able to make the flag disappears in any way when the cover is not designated as the "checkpoint" anymore. Here is the code of the "cover" object, in the "left mouse pressed" event:
Code:
var lay_id = layer_get_id("la_flag_sprite"); //part of the code dedicated to delete the precedent sprite each time left mouse is pressed again
if (layer_sprite_exists(lay_id, spr_flag1)){
layer_sprite_destroy(lay_id);
}
//everything past this point works
obj_cover.flag1 =false;
flag1 = true;
layer_sprite_create("la_flag_sprite", x, y-sprite_height, spr_flag1);
Anyone has an answer? Thank you in advance