I have been tinkering around with some of the scenarios that come with the book. I am currently studying the
source code to the scenario Breakout and I am understanding it fairly well for the exception of this part.
Focusing on the line "deltaX = deltaX + (offset/10);" what does the keyword "offset" mean and what does it do?
I appreciate any explanation.
private void checkPaddle()
{
Actor paddle = getOneIntersectingObject(Paddle.class);
if (paddle != null) {
deltaY = -deltaY;
int offset = getX() - paddle.getX();
deltaX = deltaX + (offset/10);
if (deltaX > 10) {
deltaX = 10;
}
if (deltaX < -10) {
deltaX = -10;
}
}
}