Assuming you have stored the return value of layer_sprite_create(), call layer_sprite_get_index() to get the sprite resource id back. Otherwise use the various layer_get functions (like layer_get_all_elements(), and so on) and optionally check if it's a sprite element using layer_get_element_type(). In the end you'll use layer_sprite_get_index() in order to get the sprite resource no matter which route you go. The "General Layer Functions" and "Sprite Layers" categories in the help is where you'll find the required information.Hi!
Pretty straight foward.
Is there a function that I can get the sprite that I created before in a layer using layer_sprite_create() ?
I can't find it in the manual. Sorry for the dumb question.
Thanks!
I think it's not entirely unreasonable. Using a sprite layer as a means to create an environment that instances or whatever interacts with sounds like trying to use the layer for a purpose for which it was not created. If you need that kind of interaction, it seems like instances or tiles would be more appropriate. Having said that, I'm sure someone could come up with a reasonable counter-example.So, no easy way to get sprite at a x/y?
Welp... then I store the sprite resource id on a grid...
It's the "easier" way, but there should be a function like instance_position for sprites on an asset layer. It's kinda dumb that it doesn't exist on GML. = /
There are other alternative:Welp... then I store the sprite resource id on a grid...
Probably not as bad as you may image, assuming you aren't doing it every step.@GMWolf, loop through seems a little slow for what I'm planning.