Alignment things in the gdevelop editor

Having alignment tool to either align an object of the center of the scene on the y axis or x axis or aligning it with another object, stuff like that!!

3 Likes

Really Support this, have no idea why this feature isn’t requested that much.
There are so many things that I want to align perfectly and have a hard time doing so.

Alignment tools are very easy to implement and it’ll contribute a lot to the user experience.

Totally support this.

2 Likes

If we understand that everything is positioned by its origin point
Which is top left corner X0 Y0 pixel position of object

Then

Putting something at CameraBorderLeft() CameraBorderTop()
Will change its position to top left corner

White is your viewport
Red is your object you just positioned with above expressions
Yellow on red is origin point of red object
Green are X and Y Center of screen
image

If we want to move it to the right
Then going with CameraBorderRight() CameraBorderTop()
Will Result in it going off screen
Cause again it is positioned based on its origin point

To combat this we go with CameraBorderRight()-Object.Width() CameraBorderTop() and we get this
image

How about CameraBorderRight() CameraBorderBottom() ??

Armed with knowledge we gathered so far how about
CameraBorderRight()-Object.Width() CameraBorderBottom()-Object.Height()

And now we know how to properly position it to each edge of screen
What about center?
Let’s check
CameraCenterX() CameraCenterY()

Nah let’s try CameraCenterX()-Object.Width() CameraCenterY()-Object.Height()

Too much so we would need like half of its width and height
Well let’s try
CameraCenterX()-(Object.Width()/2) CameraCenterY()-(Object.Height()/2)

I would say now we can position it to whatever the hell we want

Now we can position other object to position of our red object
And we just change position of red object to affect position of both

There is anchor behavior and same as alignment tool i say it would be cool to have but wrong to use
I can go into any expression and do like CameraBorderLeft()+20
And now my object is 20 pixel to the right from left camera border
I can put there variable and change that variable to allow players to position objects as they please
For example touch buttons/joystick
We do not have same size hands and phones so it would help a lot

Now imagine would it be easier to do it via alignment tool or via expressions?
Before you answer go try to do same crap i did with anchor behavior
I am not saying it is bad cause i think it is awesome tool
I just say i feel its better to use change position with expressions

i think you completely misunderstood the feature request

So can you explain it to me?