Added paddle boundary
This commit is contained in:
		@ -28,12 +28,18 @@ public class Paddle extends Entity {
 | 
			
		||||
	public void update(float dt) {
 | 
			
		||||
		Ball ball = getBrickBuster().getBall();
 | 
			
		||||
		if (Gdx.input.isKeyPressed(Input.Keys.LEFT)) {
 | 
			
		||||
			if (getX() - 5 - PADDLE_WIDTH/2 < 0) {
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
			setX(getX() - 5);
 | 
			
		||||
			if (!getBrickBuster().isPlaying()) {
 | 
			
		||||
				ball.setX(ball.getX() - 5);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (Gdx.input.isKeyPressed(Input.Keys.RIGHT)) {
 | 
			
		||||
			if (getX() + 5 + PADDLE_WIDTH/2 > BrickBuster.WIDTH) {
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
			setX(getX() + 5);
 | 
			
		||||
			if (!getBrickBuster().isPlaying()) {
 | 
			
		||||
				ball.setX(ball.getX() + 5);
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user