Discuss Scratch

jackrhy
New Scratcher
3 posts

How do you set the render order of sprites in a top-down game?

Hello, I have a top-down game with differnt sprites. How do I set the lower y-axis sprite to be rendered first, and the higher y-axis sprite to be rendered last?

I tried to have a loop to set the render order of different sprites based on their y-axis, but this doesn't seem working.

forever
go to [back v] layer
go [forward v] ((y position) * (-1)) layers
end

How should I do it?
ITS_DINO_XD
Scratcher
100+ posts

How do you set the render order of sprites in a top-down game?

jackrhy wrote:

Hello, I have a top-down game with differnt sprites. How do I set the lower y-axis sprite to be rendered first, and the higher y-axis sprite to be rendered last?

I tried to have a loop to set the render order of different sprites based on their y-axis, but this doesn't seem working.

forever
go to [back v] layer
go [forward v] ((y position) * (-1)) layers
end

How should I do it?
luckily I had a unshared project just for this, I shared it now, check it out at https://scratch.mit.edu/projects/1350949028/
jackrhy
New Scratcher
3 posts

How do you set the render order of sprites in a top-down game?

Thanks a lot! It does solve the layering problem.

Powered by DjangoBB