Skip to main content

Brick Game

Brick game implemented in python


Pankaj Gupta
(pankajg)
BRICK GAME (FOSSDEV) • Made by - • Pankaj Gupta The Game consists of 3 modules – (a) Pro - this is the main program which imports other two modules and has complete game. (b) Level - the module consists of framework of various levels and total number of breakable bricks in each level (c) Menu - the module makes the menu which appears at the start of the game The tasks which the game does – (a) There is a paddle and a ball at the beginning of the game (b) At the start the user can switch to any level in Menu and thereafter after completing the level the next level comes (c) User friendly collision of ball with Paddle, bricks and wall (d) Various powers falls as you hit the brick. (e) You can make Paddle bigger by taking “L” (f) You can make ball stick by taking “S” (g) You can enable firing by taking “F”. Thereafter you can fire by pressing space. (h) You can double the number of balls by taking “D”. (i) There are bricks which never breaks and few which breaks only when hit twice. (j) Initially there are 3 lives. At each ball drop life decreases. When life becomes 0, game ends. After that you can replay the game. (k) Score is displayed at the end game and you can be redirected to menu screen by pressing enter. (l) Score increases by 10 on breaking a brick (m) Life displays at top left and Score displays at top right. (n) There is a trail behind the ball which make the look of game better. (o) There are 4 classes – 1. Circle – for ball 2. Paddle – the rectangular bar that appears at the bottom screen 3. PowerUp – falling powers of various types 4. Bullet – released from center of Paddle when we press space bar key. (p) There are 13 functions – 1. Stadium() – this initializes all global variables so that once the game is over you can restart again without closing the program. 2. Createblock() – creating a brick of required color 3. Addlevel() – displays current level on screen 4. Menu() – displaying menu at the start of game 5. Getinput() – taking keyboard input and manipulating. 6. Update() – checking if number of balls on screen is less than CirclesInAir and assigning positions to trail of balls. 7. Move() – update positions of bullets, power-ups and ball 8. CollisionDetect() – detects various collision i.e ball with bricks and wall, bullets with bricks, Paddle with left and right wall, powers with paddle and ball with paddle. 9. PygameRectFromRect() - To find size to Render the Rectangle 10. IntegerisePoint() - To convert the point to the integer 11. Result() – to display the result of the match 12. Draw() - To draw the balls, powers and the paddle and update the scores 13. Main() –determines the order of calls to different functions (q) The game consists of background music and various sounds on collision and firing bullets Why can the game be extended by anyone – (a) There is a class of Paddles and hence the number of object can easily be increased. The only thing which one has to do in GetInput () is to add the instructions of getting other keys input for controlling other paddles. (b) There is a Circles class and hence number of balls can be increased easily. Also there is a variable named CirclesInAir which can be changed to control minimum number of balls present on the screen any time. Hence by changing the variable value to 2 you would always have 2 balls on the screen (c) There is a class of Powers and hence the types of powers can be increased any time. (d) You can easily edit the pattern in Level module. Future improvements – (a) Adding features like that of Jardinians and Dx-ball (b) Giving mouse input (c) Adding textures (d) Use of physics engine for collision

Changes

Links

Home Page
http://google.com

Releases

Pygame.org account Comments