Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Switching background after all sprites disapperas !!!!!!
- jak988
- New to Scratch
6 posts
Switching background after all sprites disapperas !!!!!!
Yo guys
I got this https://scratch.mit.edu/projects/195863180/ and I want to make sth like when u make all blocks dissapear then switching to another background and starts new level (“poziom” means level). So can u help me define new argument and make it possible because I don't have any ideas how I can do this.
In first level I have one line of blocks to destroy, on second I want two, on third 3 lines etc. But it hard when I destroy line in first level and don't know how switch to the second. You know what I mean
I got this https://scratch.mit.edu/projects/195863180/ and I want to make sth like when u make all blocks dissapear then switching to another background and starts new level (“poziom” means level). So can u help me define new argument and make it possible because I don't have any ideas how I can do this.
In first level I have one line of blocks to destroy, on second I want two, on third 3 lines etc. But it hard when I destroy line in first level and don't know how switch to the second. You know what I mean
- Silencer59
- Scratcher
27 posts
Switching background after all sprites disapperas !!!!!!
ooooh nice, I've played this game on my phone before. what you've done so far is spectacular.
“Would it save you a lot of time if I just gave up and went mad now?” - Douglas Adams, The Hitchhiker's Guide to the Galaxy
- mstone326
- Scratcher
1000+ posts
Switching background after all sprites disapperas !!!!!!
I made a remix for you using clones. Since the blocks are all looking for the same thing, getting hit by the ball or moving downwards we can use a single sprite and then the clones can look for the condition.
I set up a variable called level, blocksToBreak, blockPerRow, points(which I ended up not using but left in case). Each row has 8 blocks, so I set blocksPerRow to 8. I set blocksToBreak to blocksPerRow * level.
Every time we hit a block it changes blocksToBreak by -1. When all the blocks are gone that will = 0, then will call for a new level. I took out all the other scipts so I could just focus on showing you level generation. Good luck ope this helps
https://scratch.mit.edu/projects/195895344/
(Edit: I also took out all controls, just hit space and the ball will go. Then you can see how blocksToBreak counts down. When it =0 then it will generate another line. So just watch the ball bounce, then if it helps you can work into your project. You can also add in a broadcast to move down for them to move down like you had originally in your project. Clones will all respond to a single broadcast).
Also, one last note. It is never a good idea to label your backdrops or sprites as just a single number. Causes issues
I set up a variable called level, blocksToBreak, blockPerRow, points(which I ended up not using but left in case). Each row has 8 blocks, so I set blocksPerRow to 8. I set blocksToBreak to blocksPerRow * level.
Every time we hit a block it changes blocksToBreak by -1. When all the blocks are gone that will = 0, then will call for a new level. I took out all the other scipts so I could just focus on showing you level generation. Good luck ope this helps
https://scratch.mit.edu/projects/195895344/
(Edit: I also took out all controls, just hit space and the ball will go. Then you can see how blocksToBreak counts down. When it =0 then it will generate another line. So just watch the ball bounce, then if it helps you can work into your project. You can also add in a broadcast to move down for them to move down like you had originally in your project. Clones will all respond to a single broadcast).
Also, one last note. It is never a good idea to label your backdrops or sprites as just a single number. Causes issues
Last edited by mstone326 (Jan. 3, 2018 00:44:25)
High School Athletic Director / Middle School Tech Teacher / High School Baseball Coach
Kung Fu by Nintendo 1984 - https://scratch.mit.edu/projects/369994801/
Taco Defense - Speed Typing - https://scratch.mit.edu/projects/316795450/
Halloween Boss Battle - Taking Back our Woods - https://scratch.mit.edu/projects/257155118/
Almost Pong - https://scratch.mit.edu/projects/656276979/
Studio - My Best Projects - https://scratch.mit.edu/studios/4125978/
Forum Help Project Examples - https://scratch.mit.edu/studios/4133335
- Haz-_-
- Scratcher
500+ posts
Switching background after all sprites disapperas !!!!!!
Try this script:
when green flag clicked
if <(backdrop #) = [1]> then
broadcast [game over v]
end
when I receive [Game over v]OR
hide
when I receive [ game over v]hope this helped!
stop [all scripts in other sprites v]
Last edited by Haz-_- (Jan. 3, 2018 03:00:44)
continue this hashtag if you live in australia [img]http://u.cubeupload.com/rabbitcarrots/FEDB1435D41540BFB9FB.jpeg[/img] is the image code xD oh and btw this siggy is from @Hellounicorns2 :cool:
- Haz-_-
- Scratcher
500+ posts
Switching background after all sprites disapperas !!!!!!
+the link didn't work
continue this hashtag if you live in australia [img]http://u.cubeupload.com/rabbitcarrots/FEDB1435D41540BFB9FB.jpeg[/img] is the image code xD oh and btw this siggy is from @Hellounicorns2 :cool:
- Discussion Forums
- » Help with Scripts
- » Switching background after all sprites disapperas !!!!!!