Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Multiple bugs in breakout-style game (Problems with events, ball goes through blocks even with a specific script, etc.)
- BertMertDert
- Scratcher
23 posts
Multiple bugs in breakout-style game (Problems with events, ball goes through blocks even with a specific script, etc.)
So I've been making an Atari Breakout-style game, but as with any project, I've run into glitches and bugs.
Here is a link to the project: https://scratch.mit.edu/projects/113663441/
The first glitch I'm having a problem with is the ball going through the blocks, even though there is a script to make them bounce off the colour of the blocks. I'm doing this because I want the ball to bounce off the blocks from the side correctly, so the sides are black, the top and bottom coloured. It happens rather randomly, though.
The next glitch is with sprites not doing what they're supposed to do when an event is called. This can mostly be found when trying to restart the game, as the title (Text sprite, costume 1) doesn't hide itself, even though there's a script to make it do so.
Finally, there's what I call the ‘lightning rod’ glitch, as if the paddle moves into the ball, the ball will bounce around inside the paddle, and at fast speeds it looks like an electrified rod. Anyway, the ball will be stuck inside until the paddle moves so that the ball can come out.
If someone could help me with these bugs, I would be really grateful. Thanks a bunch!
Here is a link to the project: https://scratch.mit.edu/projects/113663441/
The first glitch I'm having a problem with is the ball going through the blocks, even though there is a script to make them bounce off the colour of the blocks. I'm doing this because I want the ball to bounce off the blocks from the side correctly, so the sides are black, the top and bottom coloured. It happens rather randomly, though.
The next glitch is with sprites not doing what they're supposed to do when an event is called. This can mostly be found when trying to restart the game, as the title (Text sprite, costume 1) doesn't hide itself, even though there's a script to make it do so.
Finally, there's what I call the ‘lightning rod’ glitch, as if the paddle moves into the ball, the ball will bounce around inside the paddle, and at fast speeds it looks like an electrified rod. Anyway, the ball will be stuck inside until the paddle moves so that the ball can come out.
If someone could help me with these bugs, I would be really grateful. Thanks a bunch!
- mstone326
- Scratcher
1000+ posts
Multiple bugs in breakout-style game (Problems with events, ball goes through blocks even with a specific script, etc.)
You should replace touching green, touching black scripts and replace that with touching block. That will fix the ball passing through the blocks.
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
- BertMertDert
- Scratcher
23 posts
Multiple bugs in breakout-style game (Problems with events, ball goes through blocks even with a specific script, etc.)
You should replace touching green, touching black scripts and replace that with touching block. That will fix the ball passing through the blocks.
Well, the thing is that the ball should bounce off differently from the sides, as that. But is there any other way? If not, I guess I'll just do this. Do you have any solutions for the other bugs?
- drmcw
- Scratcher
1000+ posts
Multiple bugs in breakout-style game (Problems with events, ball goes through blocks even with a specific script, etc.)
The ball will bounce around inside the paddle if you don't move it away from the paddle when it first touches it.
- Brontosplachna
- Scratcher
100+ posts
Multiple bugs in breakout-style game (Problems with events, ball goes through blocks even with a specific script, etc.)
Design alternative: Let the bricks figure out how the ball should bounce and then tell the ball. The bricks know their own location and shape. The location of the ball is easy to get as “x position of Ball” because there is only one ball. The touched brick would figure out the bounce direction, set a global variable with the direction, and broadcast a message that is received by Ball. In this way, the bricks can be any set of colors, and they can be any shape you can compute a bounce direction with.
- Discussion Forums
- » Help with Scripts
- » Multiple bugs in breakout-style game (Problems with events, ball goes through blocks even with a specific script, etc.)