Y-sort and Origin point

Is it possible to use a self made point instead of the origin point when using the y-sort behaviour?

I dont think people will answer because I doubt they use this behavior, I would tell you to do this instead:

At the eventsheet seek for the button (+) at the top-right.

After opening the context menu click on this:
For each object

Then select your object at the event it just dropped to the eventsheet.

Do this:
No conditions

Action:
Change the z-order of Object set to Object.PointY(“PointName”)

The Y sort extension uses the origin. You could do what @Reborn has written, which is the effectively what the y-sort extension does but it only uses the origin.

However, with that solution you’ll either need to put all your objects in a group and repeat over that group, or have a repeat for each object type. These repeats can drain performance. Also note that the behaviour can be turned on or off on individual objects. You can’t do that with @Reborn’s solution.

An alternative is to modify the extension. You’ve installed it on your project, so you can edit it to suit your needs. The changes will only be available in your project:

image

image


Isometric games and Zelda styled RPGs use this behaviour.

1 Like

These are gdevelop examples, with “they” I meant “Users who are helping in posts at the forum” also by the fact that this post had no answer in a 5 hours period while having probably more than 10 views (meaning that people were indeed reading the post but nobody would know how to answer because they probably dont use the behavior)

They’re not examples, they’re game genres. Keep in mind not all the forum members are online all the time, so it’s quite possible that a post will go unanswered for a few hours, or even a a day, before someone picks it up and replies.

I literally changed Y sort to use center point

I bet i could just input there some point name and then give that point to each object i would wish to use it

But for my needs center was enough

This is a weirdly dismissive way to start a post, and pretty inaccurate overall. I’d ask you to avoid throwing in unrelated conjecture based on hunches/feelings when coming to add to a help/how do I thread in the future, please.

Thanks for everyone’s help, I will modify the y-sort behaviour, can I just say I have nothing but praise for the people on the forum, if I ask a question, someone has always had the answer or pointed me in the right direction!

2 Likes

If i added a new point to my sprite and named it Zpoint, how would i input it, as Object:=Object.point “Zpoint” is not allowed?

The only way i can get this to work is if i have 2 versions of Y-sort, one normal, and one where i have to set a object variable to:
image

Then change a version of Y-sort to:
image

it works but will there be a performance hit by running to versions of Y-Sort?

This obviously will only work with one sprite, so not useful

Hmm, yeah, that didn’t work. I hadn’t thought it through enough or tried it myself, sorry.

You could set the origin (or centre if that’s not used for anything) to where you want the self made point.

Or explore writing a small JavaScript event in the behaviour extension.

Yeah I need center and origin point to stay where I’ve put them otherwise it messes up my Isometric tiles/sprites, I don’t know JavaScript but I can always learn (I hope)

I think it works. If there’s no point with that name, I think it uses the origin. The only issue is sprites are the only type that can use points. If the object type isn’t sprite, you can’t even use the pointX()

If you have other objects then they would have to use the default version of the behavior. Unless you switched it to JavaScript and had it check the object type first. Don’t ask me how.

Thanks, I will try moving the CTR point and see how it affects the alignment, luckily all my objects are sprites, I’ve been looking at some JavaScript made functions in gdvev, might be able to modify one of them

Just to chime back in, there’s no need to do any javascript to accomplish this.

As Keith mentioned you can just use the point name, which if it doesn’t exist defaults to the origin.
Editing the extension:


Points:

Eyeball above the top of the sort point
image
Eyeball below the top of the chest sort point
image

I mentioned JavaScript because the pointX() only applies to sprite objects. I wasn’t able to even add PointX() if the object type isn’t sprite.

This is what I get for not being fully awake. Yes, points only exist on Sprites, I don’t think that’ll change in JS either.

For non-sprite objects, the object variable method would work just fine, as djsedaw already tested with.

My thinking was in JS you could somehow tell if it’s a sprite. If it’s a sprite check the point if not check the origin. Luckily, they’re only using sprites. I’m sure there’s a way to check the type. I’ve never needed to. So, IDK.