The Road to PyWeek - GunFox is Complete!

I have succeeded!

GunFox version 1.0 is complete!

Now, the game has scoring, and can store up to 20 high scores!

Entries in the high score menu are also colored based on which character the player was using. Blue for Jack and green for Rachel.

I'll write a post-mortem later on today, but for now, I'm just happy that I've succeeded.

You can pick up a copy here!

(log in to comment)

Comments

Download link seems to 404. Any place I can pick up a copy now? I'm looking forward to your XML maze shooter too!
cyhawk:

It should be fixed now. Thanks for letting me know! :)
Thanks! It works quite well, the two different characters provide nice variation on the gameplay!

I got an exception on first try and fixed it with the patch below:


  File "/Users/darabos/Downloads/GunFox-v1.0.1/lib/data.py", line 332, in load_score_fonts
    high_score_font = load_font(font_file,15)
RuntimeError: Couldn't load font file

--- lib/data.py.original 2010-03-17 22:04:28.000000000 +0000
+++ lib/data.py 2010-03-17 22:04:39.000000000 +0000
@@ -326,11 +326,9 @@
 def load_score_fonts():
     filename        = path.join(data_dir,'font','FreeSans.ttf')
 
-    font_file       = open(filename,'rb')
-
-    hud_font        = load_font(font_file,20)
-    high_score_font = load_font(font_file,15)
-    input_font      = load_font(font_file,30)
+    hud_font        = load_font(filename,20)
+    high_score_font = load_font(filename,15)
+    input_font      = load_font(filename,30)
 
     return {'Hud':hud_font,'High Scores':high_score_font,'Input':input_font}

 
Huh.

See, I get a similar error when I try what your patch does...

Weird disparity between Linux and Windows Pygame perhaps?

Thanks for the info, though. :)
Huh, strange! I'm on a MacBook, Python 2.6.2 (Apple build) and Pygame 1.9.1. If the filename-based font loading does not work correctly, that sounds like a Pygame bug. Are you using 1.9.1?

When it does not work with one shared open file that makes more sense. The first font loading reads the file to its end and the second font loading will try to read it from there (neither has reason to seek to the start and they should not even assume that they can seek in the stream).

For a workaround I guess you could open and close the file once for each font.
Ah, I see why it couldn't load the file when I tried what you did...

Rather than copy/pasting your patch into a file and patching the thing, it's a small enough change where I just did it by hand.

It was really late when I posted that, and I see what I did wrong.

When I eliminated the font_file variable, I forgot to change the arguments to load_font(), and I didn't catch exactly what happened since I ran it directly instead of in a terminal.

But, by the time folks are likely to read this, I'll have a fixed version up and then a patch. :)

--Akake