| Author |
Message |
npdawson
Site Admin

Joined: 14 Sep 2006 Posts: 32 Location: Illinois |
|
AvoidGame - a game created in 2 hours using Pygame |
|
AvoidGame - a simple, yet playable game, created with Pygame
I created this little game using Python 2.4.3, Pygame 1.7.1, and finally created the .exe distribution using py2exe 0.6.
Basically I whipped this game together because I wanted to learn about Pygame. I had the following goals in mind and I reached all of them. So there probably won't be a version 2. Unless somebody really wants one...
- I wanted to figure out how to draw simple images to the Pygame Surface.
- I wanted to accept keyboard input to control the movement of a simple player object
- I wanted to create a simple game loop with a point to actually moving the player object around, as well as a point system to make it a little more rewarding.
- I wanted to create some rudimentary collision detection ( I am sure that most people will find this the most annoying part of the game, but it works!) You just have to realize that these Circles are actually rectangular PNG's with transparent backgrounds, so if you collide with the corners it looks like you should have missed the enemy.
- I wanted to create an easy to play WinXP distribution ( an .exe ) that requires no additional setup.
- I wanted to create a game that you could actually play and while not exactly being the most fun thing in the world at least it was challenging, and had a definite Start, Middle, and End.
What's the goal of the game?
- The goal of the game is simple, just stay alive and by doing so you rack up tons of points!
- You are a simple gray and black gradient circle, and you can move Up, Down, Left, and Right using your keyboard Arrow Keys.
- All you have to do is avoid your nemesis, the Orange and Yellow circle which is going to come from a pseudo-random position either along the top or left hand side of the gameboard. I have deemed this the Evil Ball. If the Evil Ball starts at the top of the gameboard it will drop straight down until it falls off the gameboard, if it starts on the left it will fly straight to its right.
- So all you have to do is dodge the Evil Ball and you will rack up the points.
How do I control the game?
- Enter/Return - Start a new game
- Arrow Up - Move the gray ball up.
- Arrow Down - Move the gray ball down.
- Arrow Left - Move the gray ball left.
- Arrow Right - You guessed it, move the gray ball right.
How to launch AvoidGame ( only tested on WinXP, sorry )
Windows XP/2000
- Download the avoidgame-windows.zip (here)
- Unzip this avoidgame-windows.zip to a suitable location, desktop or whereever
- Double-click on avoidgame.exe within that directory and it should work!
*Nix / Mac
- Download the avoidgame-src.zip (here)
- Unzip this avoidgame-src.zip to a suitable location.
- Assuming that you have Python 2.4 and Pygame installed correctly, simply type "python avoidgame.py" at the command prompt in the src/ directory and it should work.
- View and critique the source code and drop me a line on how sweet it is
Remember I did this in about 2 hours.
Game Notes
I haven't been doing much Python hacking lately and I have to admit that diving back into it last night just felt so good...
In fact, my friend Chryso inspired me, via his work and accomplishments on a certain game in progress to create a game in Python myself. So I whipped this little ditty together in just under 2 hours. Not too shabby for a playable game in an easily distributed format, using two brand new technologies (Pygame and py2exe).
Why is the zip so BIG?
I had to embed a font in there as well as reference some simple images for the Player Ball and the Evil killer Ball, and the rest of the stuff is a byproduct of creating an executable release of my original Python Source code, using py2exe.
If for some reason you want the source code, window's exe's and the design documents (.psd's) you can download everything here.
Anyway check it out and let me know what you think.
Last edited by npdawson on Sun Jul 08, 2007 9:47 am; edited 2 times in total |
|
| Fri Sep 29, 2006 12:54 pm |
|
 |
chryso
Omni-usurper

Joined: 25 Sep 2006 Posts: 18 Location: Flar-eeee-da |
|
|
|
I am disappointed by the lack of source code availability, sir.
By the way, Pygame is totally cross-platform, so if it runs in Windows, it will run on OS X and Linux.
-C.
|
|
| Fri Sep 29, 2006 2:37 pm |
 |
 |
npdawson
Site Admin

Joined: 14 Sep 2006 Posts: 32 Location: Illinois |
|
|
|
I tried to address the point in my goal of just creating a quick little .exe that would be playable by 98% of people. But I understand your point. I will get the source code out so that my brethren on Mac's and *Nix's can play the little thing. I will get it up soon... probably tomorrow morning.
|
|
| Fri Sep 29, 2006 6:53 pm |
|
 |
npdawson
Site Admin

Joined: 14 Sep 2006 Posts: 32 Location: Illinois |
|
|
|
As promised I have released the source for this game. I have updated the original post to reflect where you can find them.
Or it is right here:
Source Files for AvoidGame
|
|
| Sat Sep 30, 2006 8:27 am |
|
 |
chryso
Omni-usurper

Joined: 25 Sep 2006 Posts: 18 Location: Flar-eeee-da |
|
|
|
That's what I like to see. Source code makes the virtual world go 'round.
Speaking of source code, I've made a few changes to OW, if you are planning on purveying it some more.
More on that in the other thread.
-C.
|
|
| Sat Sep 30, 2006 8:46 am |
 |
 |
chryso
Omni-usurper

Joined: 25 Sep 2006 Posts: 18 Location: Flar-eeee-da |
|
|
|
BTW, AvoidGame is awesome! I scored 57000 points!
And to think, it was only like what, 100 lines of code? Python/PyGame is amazing.
Is it almost time for PyBreakout?
-C.
|
|
| Sat Sep 30, 2006 9:23 am |
 |
 |
npdawson
Site Admin

Joined: 14 Sep 2006 Posts: 32 Location: Illinois |
|
|
| Mon Oct 09, 2006 8:54 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|