Simple Pong | Explanations |
There is one ball near the top. There is 1 brick near the bottom. | Object declaration, instantiation, and initial placement. |
The player controls the brick. | Declaration of controlled object. |
When right arrow is pressed, the brick moves right. When left arrow is pressed, the brick moves left. |
Conditional statements for describing how the brick is controlled. |
The ball starts out moving in a random direction. | Unconditional statement for describing the initial movement of the ball. |
When the ball reaches the top border, it reverses direction. When the ball reaches the right border, it reverses direction. When the ball reaches the left border, it reverses direction. |
Conditional statements for describing how the ball moves when hitting three borders. |
When the ball reaches the bottom border, the game is over. | Conditional statement for describing gameover. |
When the ball collides with the brick, it reverses direction. | Conditional statement for describing collision between the ball and the brick. |
Map: |
Click the image to try it |
Faster Pong with Obstacles | Explanations |
There is one ball near the top. There are 10 rocks near the middle. There is 1 fast brick near the bottom. |
Object declaration, instantiation, and initial placement. |
The player controls the brick. | Declaration of controlled object. |
When right arrow is pressed, the brick moves right. When left arrow is pressed, the brick moves left. |
Conditional statements for describing how the brick is controlled. |
The ball starts out moving in a random direction at 3 pixels per frame. | Unconditional statement for describing the initial movement and speed of the ball. |
When the ball reaches the top border, it reverses direction. When the ball reaches the right border, it reverses direction. When the ball reaches the left border, it reverses direction. |
Conditional statements for describing how the ball moves when hitting three borders. |
When the ball reaches the bottom border, the game is over. | Conditional statement for describing gameover. |
When the ball collides with a rock, it reverses direction. | Conditional statement for describing collision between the ball and a rock. |
When the ball collides with the brick, it reverses direction. | Conditional statement for describing collision between the ball and the brick. |
Map: |
Click the image to try it |
Pong with Obstacles and Explosions | Explanations |
There is one ball near the top. There are 10 rocks. There is 1 fast brick near the bottom. |
Object declaration, instantiation, and initial placement with a map. |
The player controls the brick. | Declaration of controlled object. |
When right arrow is pressed, the brick moves left. When left arrow is pressed, the brick moves left. |
Conditional statements for describing how the brick is controlled. |
The ball starts out moving in a random direction at 3 pixels per frame. | Unconditional statement for describing the initial movement and speed of the ball. |
When the ball reaches the top border, it reverses direction. When the ball reaches the left border, it reverses direction. When the ball reaches the left border, it reverses direction. |
Conditional statements for describing how the ball moves when hitting three borders. |
When the ball collides with a rock, it reverses direction. | Conditional statement for describing collision between the ball and a rock. |
When the ball collides with a rock, the rock blows up. | Conditional statement for describing collision between the ball and a rock. |
When the ball collides with the brick, it reverses direction. | Conditional statement for describing collision between the ball and the brick. |
When the ball reaches the bottom border, the game is over. When all rocks are gone, you win. |
Conditional statements for describing gameover. |
Map: --l -- -- ---o---o-- -----o-----o --------------o ---o---o-- -----o-----o --------------o |
Click the image to try it |
Can you make the rocks move around as well?