random shift ball vertical position after score
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -64,9 +64,9 @@ bool Engine::control_players() {
|
||||
bool need_refresh= false;
|
||||
|
||||
if (_p1.is_human()) need_refresh |= _p1.check_pad_movement();
|
||||
else need_refresh |= _p1.check_pad_movement();
|
||||
else need_refresh |= _p1.check_pad_movement(_ball);
|
||||
if (_p2.is_human()) need_refresh |= _p2.check_pad_movement();
|
||||
else need_refresh |= _p2.check_pad_movement();
|
||||
else need_refresh |= _p2.check_pad_movement(_ball);
|
||||
return need_refresh;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user