Using #macro's for layer ID's?

HayManMarc

Member
Hello programmers,

I'm wanting to make my room layers easier for me to see and write (in my code) so I was going to use #macro's for this. But I'm not sure which way would be better. Do you?

At first, I was going to do it like this, in the Create event of a control object (where I do all my game init stuff):
Code:
#macro PERSON_LAYER layer_get_id("person_layer")
If I did that, would it be running that function every time PERSON_LAYER is called? If so, maybe I should do it like this?
Code:
global.person_layer = layer_get_id("person_layer");
#macro PERSON_LAYER global.person_layer
...so that I only run the layer_get_id function once? (unless I'm wrong about how macros work?)

(EDIT: I guess I wouldn't need to use a global variable here. Var would be sufficient.)
 
Last edited:
Top