Spreading objects out a bit and Help with Math for Tweens

The summarized contents are Solved


Hello again, tonight I worked on the logic to have my AnimalHabitats produce Products after a certain period of time. They create the Product and it sits at a spot in the AnimalHabitat. Each AnimalHabitats can hold different quantities of Products. So after they create their first Product they will keep creating them at set intervals until they reach the cap for their type of habitat. The Products are created each time, and I let them just stack on top of each other so it just looks like 1 Product visually.

I would like, when the player released left mouse on the Product and there are more than one in the stack, that that products spread out a bit from each other to give the visual clue that there are more than one product. After that they will tween to the Shop.

This is what I have so far.

This next help request isn’t strictly necessary for this project but I got to thinking it would be pretty cool to do and a good formula to have on hand in general.

The shop is always in the same spot. The Products are all varying distances away. Products farther from the shop will travel to it faster because the time of the tween is fixed. Instead of saying “Tween to Shop over 500ms”, what formula would I use so that they tween to the shop at a constant rate?

Click the red squares.

doug13579/gdevelop-spread-sprites-tween-away (github.com)

1 Like

Thanks buddy, this actually looks better than the mockup I had in my imagination. After work tonight I’ll get it set up.

1 Like

It works PERFECTLY! Thanks a lot!

1 Like