Added speed boost after a certain amount of bricks remain
Reset board after all bricks are destroyed
This commit is contained in:
		@ -60,6 +60,10 @@ public class BrickBuster extends ApplicationAdapter {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		ball.update(dt);
 | 
							ball.update(dt);
 | 
				
			||||||
		paddle.update(dt);
 | 
							paddle.update(dt);
 | 
				
			||||||
 | 
							if (getBricks().isEmpty()) {
 | 
				
			||||||
 | 
								create();
 | 
				
			||||||
 | 
								playing = false;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
 | 
				
			|||||||
@ -51,6 +51,9 @@ public class Ball extends Entity {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				if (nearest.dst(new_pos.x, new_pos.y) <= RADIUS) {
 | 
									if (nearest.dst(new_pos.x, new_pos.y) <= RADIUS) {
 | 
				
			||||||
					brickIterator.remove();
 | 
										brickIterator.remove();
 | 
				
			||||||
 | 
										if (getBrickBuster().getBricks().size() <= 39) {
 | 
				
			||||||
 | 
											speed = 8;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
					Utils.reflect(direction, segment.nor());
 | 
										Utils.reflect(direction, segment.nor());
 | 
				
			||||||
					brick_collision = true;
 | 
										brick_collision = true;
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user