pygame is
Simple DirectMedia Layer is
Site Swing

ZombieSim - v0.1

Josh T (mrbluesky)



Ignore this; I'm testing something.


Home Page:


click to view original size


ZombieSim - v0.1 - Jan 18, 2010 account Comments

If you wish to leave a comment with your account, please sign in first.

August 2, 2009 2:42pm - Francesco Mastellone - nickname: (effeemme)
Since you asked for them, a few ideas for improving your code...

As for code style, you should follow PEP 008 (space after comma, avoid single line / multi imports, etc.)
I would also name xdis and ydis to dx and dy instead, as you have in the movement functions.
As for the code itself:
Object is a bit of a bad name for a class. It's not really descriptive and it might lead to confusion over other types of objects. Personally, I'd call it GameObject.
I don't get the move method which then calls moveAxis. Is it an optimization? You might want to split the moveAxis method in its horizontal and vertical parts then.
I personally don't like that Human, Zombie, etc. objects append themselves to their respective lists. This could lead to problems were you ever to move them to different .py modules. You could write make_human and kill_human functions instead.
Doing for human in humans and other such calculations can be heavy on the cpu. You might want to look into spatial hashing, to reduce the number of humans each zombie tests against. Basically, you cut the map into sectors, and in each frame you put references to zombies & other objects in their respective sectors. When you need to check for collisions, or other space-related things, just obtain references from as few sectors as possible.
Hint: sectors can be as simple as a dictionary of sets.

As for my personal opinion... This is nice :)
August 2, 2009 12:23pm - Andy Hanson - nickname: (rhodiumgames)
Cool. Works perfect.

our projects welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
recent releases
Feb 21, 2017

Jan 31, 2017

Jan 24, 2017

Jan 18, 2017

Jan 7, 2017

Dec 30, 2016

Dec 8, 2016

Nov 28, 2016

Nov 27, 2016

... more!
for pygame related questions, comments, and suggestions, please see help (lists, irc)