Discuss Scratch

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

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)


TRY these great games


TETRIS GAME THAT WORKS 1010 PONG BREAKOUT



























scttsang
Scratcher
11 posts

breakout game

hammer965 wrote:

There can be a few different ways to do it. For my game I used a

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/
thanks
scttsang
Scratcher
11 posts

breakout game

scttsang wrote:

hammer965 wrote:

There can be a few different ways to do it. For my game I used a

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/
thanks
Is it alright if you can advise a few different ways to do it? thanks
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

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)


TRY these great games


TETRIS GAME THAT WORKS 1010 PONG BREAKOUT



























Powered by DjangoBB