random shift ball vertical position after score

This commit is contained in:
andrea
2026-03-19 22:32:01 +01:00
parent fbad1a87d6
commit 8e5fe2143c
3 changed files with 7 additions and 5 deletions

View File

@@ -36,7 +36,9 @@ int8_t Ball::get_direction_y() {
void Ball::reset_position () {
_x= BALL_RESET_X;
_y= BALL_RESET_Y;
int8_t delta= random(3);
if (random(2) == 0) delta *= -1;
_y= BALL_RESET_Y + delta;
this -> _init_directions(_direction_x);
this -> _init_directions(_direction_y);
}