Discuss Scratch

ThanosSmellsBad
Scratcher
14 posts

How can I do sprite layering?

I have both these blocks in these two pictures, and the sprites still wouldn't layer themselves. What is happening?

https://ibb.co/dpmgCgm
https://ibb.co/ph7RCq7

Last edited by ThanosSmellsBad (Nov. 1, 2023 16:46:06)

stokrotka_sp58_13
Scratcher
31 posts

How can I do sprite layering?

goforwardsomethinglayers
makes the sprites go forward a couple layers. You want them to SET their z layer to something not INCREASE the z layer.
gotobackgoforwardsomethinglayers
is a better solution.
ThanosSmellsBad
Scratcher
14 posts

How can I do sprite layering?

Those were codes from Griffpatch's tutorial, it worked for him, and it did work for me for a while until I added some new sprites and wanted to have the codes apply to every sprite not just one sprite.
ThanosSmellsBad
Scratcher
14 posts

How can I do sprite layering?

Where do I put the ‘go forward something layers’ block?
MasterofTheBrick
Scratcher
1000+ posts

How can I do sprite layering?

Check if your counter variables are local.

Last edited by MasterofTheBrick (Nov. 3, 2023 10:43:29)

ThanosSmellsBad
Scratcher
14 posts

How can I do sprite layering?

The code worked before, the sprites were all layered, but when I placed those blocks in different sprites something began to happen.
ThanosSmellsBad
Scratcher
14 posts

How can I do sprite layering?

All the variables are for each sprite only, each sprite uses its own unique variable. Can somebody put the blocks here that works?
ThanosSmellsBad
Scratcher
14 posts

How can I do sprite layering?

I did the exact same code as the video, because the only reason I was asking for help is because my code used to work, but when I applied it on my other sprites it didn't work. The clones of the sprite itself won't overlap each other, but it will overlap the other sprites. I set the Z Position variable to “for this this sprite only” so that each sprite has its own layering variable. I don't know how to add a proper Z Position variable without online tutorials. Scratch only has X Position and Y Position, but for a proper 3D game the Z Position has to exist too. This is the problem with my game, the sprites overlap each other when they are farther away, which they should only overlap another sprite if they are closer.

Here is the link to my project if anybody can help me by remixing the project then fix up the code: https://scratch.mit.edu/projects/915201069/

Thanks
-ReTeX-
Scratcher
7 posts

How can I do sprite layering?

Hmm, the project seems to work fine for me, but perhaps you could try changing
broadcastOrder Infantry
to
broadcastOrder Infantryandwait
ThanosSmellsBad
Scratcher
14 posts

How can I do sprite layering?

Ok thanks…

Does the layering work in the project for you? It doesn't work for me, the soldiers still spawn on top of each other.
GAMES_101_
Scratcher
1 post

How can I do sprite layering?

IM. IN. THIS. CHAT!!!!

Powered by DjangoBB