Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » breakout game
- scttsang
- Scratcher
11 posts
breakout game
hi there, can someone give an advice on how to start a new level once the bricks are all gone, mine script isn working. cheers xoxoYour text to link here…
- hammer965
- Scratcher
100+ posts
breakout game
There can be a few different ways to do it. For my game I used a
When the bricks at are all gone this loop ends and I had a
to set up the new level.
have a look at the ball sprite script in my game. It has comments to explain my code.
https://scratch.mit.edu/projects/141723626/
repeat until <[ bricks ] = [ 0 ]>
Script for what to do during the game
When the bricks at are all gone this loop ends and I had a
broadcast [ new level ]
to set up the new level.
have a look at the ball sprite script in my game. It has comments to explain my code.
https://scratch.mit.edu/projects/141723626/
Last edited by hammer965 (March 26, 2017 04:42:27)
- scttsang
- Scratcher
11 posts
breakout game
thanks There can be a few different ways to do it. For my game I used arepeat until <[ bricks ] = [ 0 ]>
Script for what to do during the game
When the bricks at are all gone this loop ends and I had abroadcast [ new level ]
to set up the new level.
have a look at the ball sprite script in my game. It has comments to explain my code.
https://scratch.mit.edu/projects/141723626/
- scttsang
- Scratcher
11 posts
breakout game
Is it alright if you can advise a few different ways to do it? thanksthanks There can be a few different ways to do it. For my game I used arepeat until <[ bricks ] = [ 0 ]>
Script for what to do during the game
When the bricks at are all gone this loop ends and I had abroadcast [ new level ]
to set up the new level.
have a look at the ball sprite script in my game. It has comments to explain my code.
https://scratch.mit.edu/projects/141723626/
- hammer965
- Scratcher
100+ posts
breakout game
Looking at your script I think the best way to do it will be to put an if bricks left = 0 loop on the ball sprite as below
you just need to set up the script so that the first level and then every subsequent level is set up by the broadcast new level.
repeat until <[ lives left ] = [ 0 ]>
existing script
if <[ bricks left ] = [ 0 ]> then
broadcast [ new level ]
stop [ this script ]
you just need to set up the script so that the first level and then every subsequent level is set up by the broadcast new level.
Last edited by hammer965 (March 26, 2017 07:06:24)
- Discussion Forums
- » Help with Scripts
- » breakout game