diff options
-rw-r--r-- | src/paddle.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/paddle.c b/src/paddle.c index 02dec02..4a02e3d 100644 --- a/src/paddle.c +++ b/src/paddle.c @@ -6,15 +6,18 @@ void update_paddle(struct paddle *pad) { + int min; int max; pad->pos += pad->speed * pad->dir; if (pad->type == PADDLE_TYPE_H) { + min = 3; max = BOARD_WIDTH - 2; } else { + min = 2; max = BOARD_HEIGHT - 2;; } - if (pad->pos < pad->size / 2 + 2) pad->pos = pad->size / 2 + 2; + if (pad->pos < min + pad->size / 2) pad->pos = min + pad->size / 2; if (pad->pos > max - pad->size / 2) pad->pos = max - pad->size / 2; } |