Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
66bd930e2e
@ -12,6 +12,7 @@ public class Paddle extends Entity {
|
||||
public static final int PADDLE_WIDTH = 100;
|
||||
public static final int PADDLE_HEIGHT = 16;
|
||||
public static final int PADDLE_Y = 25;
|
||||
public static final int PADDLE_SPEED = 10;
|
||||
|
||||
public Paddle(BrickBuster brickBuster) {
|
||||
super(brickBuster, BrickBuster.WIDTH/2, PADDLE_Y);
|
||||
@ -29,21 +30,21 @@ 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) {
|
||||
if (getX() - PADDLE_SPEED - PADDLE_WIDTH/2 < 0) {
|
||||
return;
|
||||
}
|
||||
setX(getX() - 5);
|
||||
setX(getX() - PADDLE_SPEED);
|
||||
if (!getBrickBuster().isPlaying()) {
|
||||
ball.setX(ball.getX() - 5);
|
||||
ball.setX(ball.getX() - PADDLE_SPEED);
|
||||
}
|
||||
}
|
||||
if (Gdx.input.isKeyPressed(Input.Keys.RIGHT)) {
|
||||
if (getX() + 5 + PADDLE_WIDTH/2 > BrickBuster.WIDTH) {
|
||||
if (getX() + PADDLE_SPEED + PADDLE_WIDTH/2 > BrickBuster.WIDTH) {
|
||||
return;
|
||||
}
|
||||
setX(getX() + 5);
|
||||
setX(getX() + PADDLE_SPEED);
|
||||
if (!getBrickBuster().isPlaying()) {
|
||||
ball.setX(ball.getX() + 5);
|
||||
ball.setX(ball.getX() + PADDLE_SPEED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user