Archived:How to develop brick-breaker game in PySymbian - Part 3
Brick-Breaker is a simple arcade game where the player moves a paddle on the screen and bounces a ball towards bricks at the top of the screen. When the ball hits a brick it breaks and the ball bounces back - the objective of the game is to destroy all the bricks. This is the third and final article explaining the PySymbian implementation of Brick-Breaker - it covers code for the moving ball, intializing the bricks parameter, slider parameter and sequence of calling functions.
Finally we have the last article in the series of "How to develop brick-breaker game in Python. If you have followed the previous articles in this series, then after finishing this one, you should be able to create your own Brick-breaker or similar game using PySymbian.
In this article we learn about the code for the moving ball, intializing the bricks parameter, slider parameter and sequence of calling functions. Let's discuss them in detail.
Code for moving the ball
Here we have a little code for moving the ball in canvas. This ball is moving automatically.
Thus the code for moving the ball could be as follows:
# import module
#define exit function
#Set the screen to large
#Create an instance of Canvas and set it as the application's body
#define circle coordinate
if ((y1<0) or (y1>k-15)):
# Sleep for 0.1
Sequence of calling functions
The defined functions need to be called in a proper sequence. sequence of calling functions are as follows:
erase_bricks(12) #Should be called when collision is detected- See Related Links
app_lock = e32.Ao_lock()
The this article in the series- Part 3 for brick-Breaker , cover whole brick breaker game in canvas.
This concludes the series of articles about creating the game.