Breakout begins with five rows of bricks, each row a different color.
The color order from the bottom up is blue, cyan, green, green and red.
Using a single ball, the player must knock down as many bricks as possible by using the walls and/or the paddle below to ricochet the ball against the bricks and eliminate them. Blue bricks earn one point each, cyan bricks earn two points, green bricks earn three points, yellow bricks earn four and the top-level red bricks score five points each. To add to the challenge, the paddle shrinks to one-half its size after the ball has broken through the red row and hit the upper wall.
(adapted from Wikipedia)
Paddle is controlled with mouse.
Nine speed levels, changed using num-keys: 1...9.
Sound effects are switched on/off using 'S'.
Game is paused either with mouse press or 'P'.
breakout % Start Main Breakout Interface
Per-Anders Ekstrom (2019). Breakout (https://www.mathworks.com/matlabcentral/fileexchange/14152-breakout), MATLAB Central File Exchange. Retrieved .
it is benefit and correct thanks
-If you catch the ball against the wall and press the paddle up against it, the game goes into an infinite loop of the ricochet sound and freezes; Then Matlab crashed when I closed it. I couldn't duplicate the effect when I tried though.
-It seems if you increase the angle and velocity of the ball and hit the space between two diagonal blocks the ball will go through the diagonal blocks and destroy all of the blocks in its current pathway until it returns to normal movement again. Note: I kind of like this, it makes the game go a bit quicker.
The game is very nice
Very nice game. I didn't found any bugs. The interface is very nice and easy to use. But the game could be excellent, if you add some bonus hidden in the bricks, like additional life, sticking bracket, bracket with missiles, larger brakers.
Very good work
I will update the file with your new feature.
Excellent game! I remember playing this on an Atari... once upon a time. :o) Well written. No bugs that I found.
However, I had problems with the mouse wandering out of the figure window as well, even if I maximized it, and it was often at critical times in the game... so I added a couple lines of code that made a huge difference:
line 223: case 99 % Move Paddle
line 224: ptr = get(0,'pointerlocation');
line 225: pos = get(gcf,'position');
line 226: set(0,'pointerlocation', [ptr(1) pos(2)+pos(4)/2]);
This puts the up/down pointer location right in the middle of the figure window so it doesn't wander to the top or bottom... (and pressing ALT -on a PC at least- will release the pointer when desired)
Love this game!
Pretty good. If you do try this, use it with the figure window maximized. Otherwise if your mouse wanders out of the figure window, the paddle stops responding since it uses windowbuttonmotionfcn to follow the mouse. It also got a little testy for me a few times when the paddle would not respond quickly enough. This was probably related to the speed of my cpu though. Also, the number keys seemed not to have any effect on the speed when I tried them.
Tested using R2006b on OS X.
New pointer control, by Joseph Kirk (email@example.com)
Inspired: DFT - Delayed Feedback Tracking