z-layer for objects created with action Create Object

Hello, it’s me again :smiley:

Happy New Year! :smiley:

I have a problem with objects created on the fly with the action Create Object: they are created “behind” the other objects already on the screen and I would like them to be on top of them. This applies to things like “bullets” and other projectiles as well as some helper texts I’m placing when the player needs to find or do something in order to continue.

Any ideas please?

Hi, and happy new year.

You just need to change the object z-order after its creation. Actions to do that can be found under “All object” category

Thank you! :smiley:

Is this working with primitive drawer objects?

Yes (as the action is in the “All objects” category.

Thanks for the reply,

yes, I can find it in that category, that’s why I expected it to work.

I made a simplified example, to explain my difficulties.

The code below draws 2 overlapping circles.
No matter how I change the z-orders, the last drawn circle (left) in the code is always in front of the first drawn circle.

What am I doing wrong?

The z-order of the painter object is applied to all the shapes drawn with it.
Use a different painter to do what you want.

Thank you very much, victor.

If was trying to get the data drawn in the correct order using layers and I was trying to use the primitive shape painters.

Now it seems, both ideas would require some dynamic creation - either creating layers dynamically or creating dynamic shape painter.

Can the primitive shape painters be created dynamically?

You can use two different Shape Painter object or even create them if you really need it. Of course you can do it as they are normal objects like any other.

Thank you very much for the reply.

I will try to make things work the way you told me.
Got it working, thanks to your help, thank you very much.