Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » I'm trying to make it so that things that are lower on the Y axis go in front of things that are higher on the Y axis
- the_extreme_coder
-
93 posts
I'm trying to make it so that things that are lower on the Y axis go in front of things that are higher on the Y axis
How would I do this?
- deck26
-
1000+ posts
I'm trying to make it so that things that are lower on the Y axis go in front of things that are higher on the Y axis
Easiest method is to make a broadcast which makes each object wait until a variable is lower than the objects y-position and then it goes to the front. Then run a loop to set the variable to 180 and step it down to -180 - steps of 5 or 10 may be OK rather than stepping 1 at a time. Add a wait 0 seconds and repeat if necessary.
Depends a bit on how much things are changing though. If only one or two objects are changing their layer there will be better ways to do this.
Depends a bit on how much things are changing though. If only one or two objects are changing their layer there will be better ways to do this.
- beniwal577
-
16 posts
I'm trying to make it so that things that are lower on the Y axis go in front of things that are higher on the Y axis
Here maybe try this:
Put this in each sprite you are using.
Last edited by beniwal577 (Oct. 17, 2021 15:09:47)
- orangetheory
-
500+ posts
I'm trying to make it so that things that are lower on the Y axis go in front of things that are higher on the Y axis
We can make 2* global variables, and set them to the y position of the sprite. Then, we can use an if statement to check every single frame whether or not one sprite is higher than the other.
*two is for demonstration purposes. Make as many variables as there are sprites/clones.
Kind of like this:
*two is for demonstration purposes. Make as many variables as there are sprites/clones.
Kind of like this:
Last edited by orangetheory (Oct. 17, 2021 15:11:54)
- the_extreme_coder
-
93 posts
I'm trying to make it so that things that are lower on the Y axis go in front of things that are higher on the Y axis
Thank you everyone for the help!
- Discussion Forums
- » Help with Scripts
-
» I'm trying to make it so that things that are lower on the Y axis go in front of things that are higher on the Y axis