First off the background is scrolling and doing this I'm using 10 different sprites that make up the background. This works fine.
My largest problem is the order of sprites. So when two sprites are lined up on the x axis the one that has the lower y position should be the one on top instead of the other way around.
I tried using code i found online for this where in the stage you put
When (green flag pressed)
forever
broadcast "all front" and wait
set Sprite-Index to 0
broadcast sortSprites and wait
Then on each sprite have
When i receive "all front"
go to front
When I receive "sortSprites"
wait until (sprite Index = my index) //don't know what my index should be i put y position here b/c couldn't find a my index in the code. didn't say how to set this if it is a variable.
go back (y position + 180) layers
This code makes the characters flash since the background sprites pop up in front even if I try sending them back 5000 layers. It never seems to help.
How can I get this to work? Anyone have any ideas or have an example I can look at.
Offline
The script seems to be continuously broadcasting "all front"; the sprites will constantly move to the front. So maybe moving them back 5000 layers won't help in the long run?
Offline
yes but the backgrounds don't have the go to front on them. so I'm trying to keep them behind the other sprites while getting the other sprites to show up in the right order according to the y direction.
I was thinking of maybe just checking is touching sprite for this but I think that would be to slow to check for every sprite that could be possible rather than just getting the layers changed when someone changes on the y.
this would be easier if there were some way to set to layer x rather than bring to front and then send back x layers.
Has anyone gotten anything like this to work? Or is there no way of doing this that will not slow down scratch?
Offline
go back -1 = go forward 1 layer
and there are always exactly as many layers as you have sprites
for specific help, upload your project and then post a link to it here
Offline
Here is the game as it stands. http://scratch.mit.edu/projects/kodarr/2062825
there are going to be many zombies on the screen at once right now I have just one other zombie but I'd like to have around 20 different zombies at a time on the screen. This would be easier if I could just set the layer. I know I can move to front then back x amount. but this makes everything blink on the screen when the two sprites overlap.
You'll see a few different disconnected codes I have been trying. I'd be thankful if anyone can figure out how to fix this.
Offline
bumping this off page 2 back to page 1.
Has no one ever made a final fight style game or a game similar to streets of rage, golden axe, TMNT the arcade game, splatter house, river city ransom, or any of those side scrolling beat em up games.
I would love to see how people handle making a character that is closer to the bottom of the screen show up in front of the other characters so that you don't see anyone walking through the chest or head of the other characters.
I've been searching for game examples but finding games with specific mechanics is very hard with the limited search they have for projects.
Offline
i got some info from combining all posts then picking out the best parts for my new game to be posted
Offline
Do you have a link of your game that uses the layers to find out who is in front of who so there is no walking through faces of other people.
Or any info where I can find this since I been searching the forums and the projects for this with no luck. If you found something I would be ever so thankful. At this point I'm almost thinking scratch can't do this since you can't set layers only move up or down by x layers. And when you send to front only to move back there is blinking of sprites and the game slows down to almost unplayable proportions.
Offline
bumping back to page one. Still can't get this working if anyone can even give me some hints on how to do this I'd be greatly appreciated. This would be so much easier if you could just say set layer x. but with the go to front then moving back the sprites blink constantly.
Offline