Discuss Scratch

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!
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.

Technology Director / Teacher Grades K-8
Head High School Baseball Coach

WIP - Frozen Rope Baseball 2
https://scratch.mit.edu/projects/169357604/
Most Recent - Meltman
https://scratch.mit.edu/projects/144049407/
Studio - My Best Projects
https://scratch.mit.edu/studios/4125978/
BertMertDert
Scratcher
23 posts

Multiple bugs in breakout-style game (Problems with events, ball goes through blocks even with a specific script, etc.)

mstone326 wrote:

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.

10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
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.


Powered by DjangoBB

Standard | Mobile