Jump to content

  • Log In with Google      Sign In   
  • Create Account





[Development] I've made Pong and Breakout in Pygame!

Posted by superman3275, 27 June 2013 · 612 views

Pygame Python Programming Game Development Classics Pong Breakout
Well, I did it. Pong and Breakout in pygame!

I'm not putting Pong up, it was hacked together and I'm not very proud of it.

I am, however, putting up Breakout! I coded a finite-state-machine, a basic button GUI system, all of my states, the paddle, the ball, the bricks, all object-oriented with beautiful pygame! And everything is completely commented, with classes having long documentation strings. It comes in at a little over four-hundred lines, and the executable is here:

BREAKOUT Posted Image!

And the source (along with the executable file and setup.py):

BREAKOUT SOURCE Posted Image!

I am very proud of this code. It looks (and feels) beautiful, and I can't wait to work on some more games (I see space invaders in the future!).

I'm going to eventually write a source analysis and talk about it more, however it's pretty late and I should probably get to bed.

See you guys tomorrow Posted Image!

And I'm back! That was some good sleep!

So, I made a video of the game!

And I'm really happy with how it turned out! I'm working on adding more levels as we speak Posted Image!

A Few Hours Later - And I'm back!

I'm actually uploading the files in the morning, however there is now:

FOUR AWESOME LEVELS!
SOME BRICKS TAKE TWO HITS, AND IF THEY ARE HIT A DIFFERENT TEXTURE (BROKEN BLOCK) IS DISPLAYED!
MAPS ARE AWESOMELY GENERATED USING EITHER A LIST COMPREHENSIONS OR TRADITIONAL FOR LOOPS!
COLORS ARE RANDOM!
THERE IS A RANDOM MAP, A PYRAMID MAP, AND A RAINBOW MAP!
THERE IS A MAIN MENU!
THERE IS A GAME OVER SCREEN!
ONCE YOU COMPLETE A LEVEL YOU ADVANCE TO THE NEXT LEVEL. IF THE BALL GOES OFF THE SCREEN YOU GO TO THE GAME-OVER SCREEN!

I believe it is finished! Have fun :)!

NEXT PROJECT: SPACE INVADERS, SUPERMAN3275 STYLE!




And where is the screenshot?

Tried exe, seems nice :) Just two question

 

1) Why does ball sometimes penetrate through few bricks instead of bouncing away when hit? For example, ball managed to get to the bricks in the 2nd row from top despite bricks from 3rd and 4th row being in the way.

 

2) This is minor, but... when the brick is destroyed, why are surrounding bricks changing color? XD

 

Anyway, congratulations for completing it.

And where is the screenshot?

Isn't an executable better :0!

 

I'll put in a screenshot soon.

Tried exe, seems nice smile.png Just two question

 

1) Why does ball sometimes penetrate through few bricks instead of bouncing away when hit? For example, ball managed to get to the bricks in the 2nd row from top despite bricks from 3rd and 4th row being in the way.

 

2) This is minor, but... when the brick is destroyed, why are surrounding bricks changing color? XD

 

Anyway, congratulations for completing it.

1) Well, my collision isn't the best...

 

2) That has never happened for me. I think that it just looks like they change color.

 

Thanks :)!

Superman,

 

On your video the game seems fast, but when I run it last time the ball was moving x3-4 slower, so it was a bit of boring, not sure if this is a bug or you've made enhancements.

Superman,

 

On your video the game seems fast, but when I run it last time the ball was moving x3-4 slower, so it was a bit of boring, not sure if this is a bug or you've made enhancements.

You just need to run it again. The ball's speed is randomized somewhat, and I can't completely make it random and make it never be slow, so just running the game again will give you a new (hopefully faster) ball speed.

PARTNERS