GMS 2 How can I child one instance to another?


Creative Sam

I am a newb at GameMaker. I have a 2D map which you can move around. I want to add pins to the map, such that when the map moves, the pins stay in the same position relative to the map. By default, the map will move, while the pins remain stationary.

I have tried creating a sub-layer of instances on my map instance layer, but the depth of the sub-layer is always greater than the parent layer. I have tried overriding the depth, but it gives me a warning suggesting unpredictable results.

I have searched the internet, but all I could find was overkill code which I am hoping is not necessary. (And none of those suggestions directly addressed my question.)

How can I make it so that my pins move around with the map? I would like to avoid using code for something so simple.


I don't really understand either your title or your question or enough about what you are trying to do. Your title says "How can I child one instance to another" but your post talks about layers in the room editor. These are not the same thing. Additionally, it seems what you want to do if have pins on a map move when the map moves. This is not related to inheritance, in either objects or layers, and not related or solvable by using layers at all.

It might be helpful to explain a little more about what you want.

For the moment, I'll assume your question is "How can I make is so that my pins move around with the map". To answer this question we would need to know what your map is - e.g. is it a surface, a view, an entire room, etc. - what your pins are - objects, sprites on an asset layer, etc. - and what your code to move the map around is.