The Final Version Features

Hi, I just wanted to thank kfields, saluk for their comments on my game. I worked and improved the timing and have improved the ui for the key display just before the deadline :). Hope it is better than before. Check out the latest screen shots

(log in to comment)

Comments

When I try to run it, I get the following error:
Traceback (most recent call last):
  File "run_game.py", line 16, in 
    main.main()
  File "/home/james/src/misc/pyweek6/RoboMinions-1.2/lib/main.py", line 740, in main
    game.load_level()
  File "/home/james/src/misc/pyweek6/RoboMinions-1.2/lib/main.py", line 482, in load_level
    self.bg1 = data.load_img(lines[3][:-1])
  File "/home/james/src/misc/pyweek6/RoboMinions-1.2/lib/data.py", line 35, in load_img
    return pygame.image.load(os.path.join(data_dir, filename))
pygame.error: Couldn't open data/g_backdrop.png
data/g_backdrop.png exists and is viewable.
Hi Bob, I guess there is some problem with pygame1.8.. i have tested and developed over pygame1.7 with python2.5 Please let me know your pygame version and the os you are running on.
I have pygame 1.7 and got the same error. Doesn't make sense though cause I can start up a python shell and :
>>> import pygame
>>> pygame.image.load('data/g_backdrop.png')
Surface(640x480x24 SW)>
so it looks to me like pygame is loading the image fine. Any other ideas why this might be happening?
sorry, forgot to add: my OS is Ubuntu 7.10 64 bit.
I'm getting the same error on MacOSX 10.4 with pygame 1.7.1. The image opens fine with Preview. Very strange.
I'm getting the same error on Mac OSX 10.4 as well. I'm not sure what's going on here -- I'd really like to play this game, as it looks very nice!
I have seen this error when you start run_game.py from a directory that is not the gamedir.
In the case of 'Bob the Hamster', I would try
cd "/home/james/src/misc/pyweek6/RoboMinions-1.2
python run_game.py
opps!Forgot the closing double quote:
cd "/home/james/src/misc/pyweek6/RoboMinions-1.2"
python run_game.py
hmm.. i doubt if they were running it from some other directory.. but Well i guess its' worth trying .. plz guys.. try claxo's suggestions..

No, I was already inside "/home/james/src/misc/pyweek6/RoboMinions-1.2" when I run python run_game.py

Anyway, I found the problem. You level data is stored in text files with DOS line endings. (CR/LF) but for whatever reason, the CR is still there when the g_backdrop.png line read from data/l1.txt gets passed to load_img()

Here is the patch that I used to work around the problem.

--- lib/data.py.orig    2008-04-14 10:10:28.000000000 -0700
+++ lib/data.py 2008-04-14 10:10:40.000000000 -0700
@@ -32,7 +32,7 @@
     return pygame.font.Font(os.path.join(data_dir, filename), size)
 
 def load_img(filename):
-    return pygame.image.load(os.path.join(data_dir, filename))
+    return pygame.image.load(os.path.join(data_dir, filename.strip()))
 
 def get_fname(filename):
     return os.path.join(data_dir, filename)
thanks man.. i hope this helps everybody...