diff --git a/core/src/com/me/brickbuster/entity/Paddle.java b/core/src/com/me/brickbuster/entity/Paddle.java index 0451f59..c0c386f 100644 --- a/core/src/com/me/brickbuster/entity/Paddle.java +++ b/core/src/com/me/brickbuster/entity/Paddle.java @@ -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);