I made a menu for my project that tweens from offscreen to center, and back offscreen. I used the pin example from the gdevelop examples to keep all the buttons and layers and selection boxes together when it tweens in and out. I’m very happy with it. But now that it’s done I can’t help but wonder…is it too powerful?
I think it’s meant for objects that move around the screen a lot. I’m not rotating the objects. They just need to keep their position relative to a menu that moves back and forth.
So this is an example from using the pin it example:
And I’d like to see if anyone has alternative suggestion that requires less calculation since my menu is not rotating or jumping, and maybe this solution is more powerful than I need for this situation.
Well I found 2 ways… I made a new group and put every item that made up the menu into that group. Then for the tween in, instead of tweening to a position like:
tween x position of group to "screen.Width()/2
or wherever you want it , command the tween like this:
tween x position of group to group + screen.Width()/2.
Or you can also just:
change x position of group add screen.Width()/2 if you don’t want a tween.
I still am using pin it when a bool is true (it is true/then false when player touches a tab to look at another tab in menu) because it sets everything in the menu back where it should be so they can scoll through the items in order. But the benefit of not using the pin it for moving the menu in and out is that now if the player has scrolled through a tab and selected an item or closed the menu, when they open the menu again the tab is right where they left it and won’t reset to it’s real position until they hit another tab. Which is what I was aiming for in this situation.