User manual
011
if(engine.joypad.isPressed(RIGHT) && ballX < 115){
012
ballX = ballX + 1;
013
}
014
}
With the controlBall() function the buttons are now queried and the position of the
ball is changed as per input. Of course, the "stubborn ball" is subject to the laws of
physics. So the natural movement of the ball can only be influenced.
001
void loop(){
002
if(engine.update()){
003
controlBall();
004
if(engine.isFrameCount(10 - (level/10))) {
005
moveBall();
006
}
007
if(engine.isFrameCount(25 - (level/4))) {
008
movePlayer();
009
}
010
drawPlayer();
011
drawBall();
012
drawField();
013
}
014
}
The functions within the loop routine must be called up one by one so that the
chronological sequence of all operations is well coordinated. The function
IsFrameCount() is used to control the speed of events. The position of the ball is
changed every 10 image reconstructions and the paddle position every 25 image
reconstructions. Thus the ball movement is updated more frequently. Also the
degree of difficulty is integrated here. The update interval becomes a little shorter
with each level and hence the movement faster. Over time, the game becomes
more and more challenging.