• 2D
  • The lowest level of z_index

Hello everyone again!) When I create a new box, it appears on top of the old one, which is not good, how to fix it? (Sprite 2d)

Hi and welcome to the forum. Your post was stuck in the moderation queue, but I have approved it. Please confirm your account with the email we sent so you can post freely in the future.

To answer your question, you might want to add a YSort node as a parent to all the red cubes. This will adjust the z-index automatically for you. Or if your level is small or needs special care, you can simply specify z-index values on each object, but in most cases YSort will be easier.

I fixed it! Thank you)

But a new problem has appeared, namely the movement at an angle of 60 degrees is kind of jerky and it looks very unattractive. Can this be fixed somehow?

Can you explain more about how you are handling movement or maybe share some code? If you want to post code you will have to add "~~~" (without quotes) on a line by itself directly above and below the code you are posting on the forum. And be sure to confirm your email so you can continue to post. Thanks.

@cybereality said: Hi and welcome to the forum. Your post was stuck in the moderation queue, but I have approved it. Please confirm your account with the email we sent so you can post freely in the future. Yes, yes, I did it, thanks.

@cybereality said: To answer your question, you might want to add a YSort node as a parent to all the red cubes. This will adjust the z-index automatically for you. Or if your level is small or needs special care, you can simply specify z-index values on each object, but in most cases YSort will be easier. This is the solution I found on this forum, thanks).

@cybereality said: Can you explain more about how you are handling movement or maybe share some code? I put a point in the world and move the object there. func _process(delta): move_and_slide(position.direction_to(target.global_position) * speed)

Can't figure out how to post the code correctly, how to insert tabs?)

And excuse my bad English, I know three languages, and it's very difficult for me to learn 4, but I'm trying!

It is this code that makes the movement kind of discontinuous, or something.> @Bredemar said:

func _process(delta): move_and_slide(position.direction_to(target.global_position) * speed)

This is how it happens. From point A to point B.