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

posted in Retro Grade
Published June 28, 2013
Advertisement
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 smile.png!

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

BREAKOUT SOURCE smile.png!

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 smile.png!

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 smile.png!

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!
2 likes 6 comments

Comments

Czarek Tomczak

And where is the screenshot?

June 28, 2013 07:11 AM
Josip Mati?

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.

June 28, 2013 11:00 AM
superman3275

And where is the screenshot?

Isn't an executable better :0!

I'll put in a screenshot soon.

June 28, 2013 01:32 PM
superman3275

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 :)!

June 28, 2013 01:34 PM
Czarek Tomczak

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.

July 01, 2013 07:27 AM
superman3275

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.

July 01, 2013 01:07 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement