3
\$\begingroup\$

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.

enter image description here

enter image description here

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.

\$\endgroup\$
0
\$\begingroup\$

This does not directly answer the question, as it uses code. So hopefully a better answer without using code comes along.

Add to the Begin Step Event:

mapStartingX = inst_map.x;
mapStartingY = inst_map.y;

Add to the End Step Event:

xOffset = mapStartingX - inst_map.x;
yOffset = mapStartingY - inst_map.y;
x -= xOffset;
y -= yOffset;

I really hope this answer becomes obsolete. GameMaker is a widely used game engine and supposedly beginner friendly without code - I can't imaging they are missing this basic functionality.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.