Files
arduino_pong/src/paddle.cpp

35 lines
500 B
C++
Raw Normal View History

2026-03-17 23:25:30 +01:00
#include <Arduino.h>
#include "config.h"
2026-03-17 23:25:30 +01:00
#include "paddle.h"
2026-03-17 23:25:30 +01:00
void Paddle::move_pad_up() {
if (_position > 0) {
_position -= 1;
}
}
void Paddle::move_pad_down() {
if (_position + _height < MATRIX_HEIGHT) {
_position += 1;
}
}
2026-03-17 23:25:30 +01:00
uint8_t Paddle::get_position() {
return _position;
}
2026-03-17 23:25:30 +01:00
bool Paddle::is_human() {
return _human;
}
2026-03-17 23:25:30 +01:00
void Paddle::increase_score() {
if (_score <= 9) _score += 1;
}
2026-03-17 23:25:30 +01:00
uint8_t Paddle::get_score() {
return _score;
}
void Paddle::reset() {
_score= 0;
}