L
Lobos
Guest
I am trying to create something similar to a building in a classic RTS game (like Starcraft, Age of Empire, etc.).
When I place a "building" object, it create "button" objects (like "upgrade building" button, "create unit" button, etc.) for each building (in x,y-50, x,y+50, like a flower, not on the GUI layer).
My goal is: when the player clicks on one of the buttons, it affects the building (for example with a variable_instance_set() ), but only that one building and also, this has to work backwards too: when the building is destroyed, it must destroy the buttons assigned to it, but not any other building's same buttons.
Please suggest a short code to work this out (my first idea was with the "with", but that only help when creating the buttons).
When I place a "building" object, it create "button" objects (like "upgrade building" button, "create unit" button, etc.) for each building (in x,y-50, x,y+50, like a flower, not on the GUI layer).
My goal is: when the player clicks on one of the buttons, it affects the building (for example with a variable_instance_set() ), but only that one building and also, this has to work backwards too: when the building is destroyed, it must destroy the buttons assigned to it, but not any other building's same buttons.
Please suggest a short code to work this out (my first idea was with the "with", but that only help when creating the buttons).