M
Midastouch
Guest
Hello everyone,
I try to improve my HUD system for my RTS.
Actually i use object to build my GUI.
For exemple i click on the button "energy" (image below) :
It creates more objects on my GUI :
This is my code, if i click in the button energy :
Finally, if i click on my "obj_button_panel" i can now put my solar panel on the map.
As you can see it's heavy, i need to put the new coordinates for each buttons and it's more and more complicated because i will have many object that i can build.
Can you help me?
I try to improve my HUD system for my RTS.
Actually i use object to build my GUI.
For exemple i click on the button "energy" (image below) :
It creates more objects on my GUI :
This is my code, if i click in the button energy :
GML:
if mouse_check_button_pressed(mb_right)
{active = false}
if (active = true && !instance_exists(obj_energy_cat_1))
{
///
instance_create_depth(10,750,-1,obj_energy_cat_1)
instance_create_depth(117,750,-1,obj_button_panel)//IF I CLICK HERE FOR EXEMPLE
///
instance_create_depth(10,800,-1,obj_energy_cat_2)
instance_create_depth(117,800,-1,obj_button_wire)
instance_create_depth(181,800,-1,obj_button_battery)
///
instance_create_depth(10,850,-1,obj_energy_cat_3)
instance_create_depth(117,850,-1,obj_button_lamp)
}
if active = false
{
///
instance_destroy(obj_energy_cat_1)
instance_destroy(obj_button_panel)
///
instance_destroy(obj_energy_cat_2)
instance_destroy(obj_button_wire)
instance_destroy(obj_button_battery)
///
instance_destroy(obj_energy_cat_3)
instance_destroy(obj_button_lamp)
}
Finally, if i click on my "obj_button_panel" i can now put my solar panel on the map.
As you can see it's heavy, i need to put the new coordinates for each buttons and it's more and more complicated because i will have many object that i can build.
Can you help me?