User manual

001
void drawBall() {
002
engine.drawPixel(ballX, ballY);
003
engine.drawPixel(ballX + 1, ballY);
004
engine.drawPixel(ballX - 1, ballY);
005
engine.drawPixel(ballX, ballY + 1);
006
engine.drawPixel(ballX, ballY - 1);
007
}
This function with the appropriate name drawBall(), the places ball on the display.
A few simple lines are needed to activate the appropriate pixels on the display.
Basically, this is due to the fact that most of the work is taken care of in the back-
ground by the game
engine. The current position of the ball is identified by the variables ballX and bal-
lY. The entire ball is drawn by drawPixel() function calls, which activate the pixels
at the current ball position and the immediate surroundings of the ball. You can
customize the shape of the ball by modifying pixels surrounding the ball position
that you also wish to activate. Note that the pixel with the position 0.0 is located in
the upper left corner.
001
002
003
004
005
Finally, the moveBall() function gets the ball moving. Every time this function is
called up, the x position of the ball will increase by 1. To put it plainly, this means
that the ball on the display moves to the right. The two following lines below en-
sure that the ball will not exit the dimensions of the display.
The modulo function ensures that the x-coordinate will never be greater than 128
and the y-coordinate will never be greater than 64 - these are exactly the 128 x 64
pixels available for the display.
001