Not quite happy with it, but it's something

Note: Ignore the menu, it doesn't do anything useful, and on linux you may need to fix the line endings on data/items.txt

I think most of the bugs are gone. The game balance is waaaaay off. It was too hard up until recently when I realized that the player's statistics weren't getting copied to the fight scene (so every fight you were basically level 0). Also, there was a bug with the armor statistic in that other than equipped armor, the characters armor level (sort of like defense) wasn't being applied unless the shot happened to hit one of your armor pieces. Those two fixes changed the balance a lot, so it's probably way too easy. You also level up insanely fast, by the end of the (very short) game, you don't even need to aim and you can get a perfect shot every time.

I don't know if I'll expand this post pyweek, but if I do, there's certainly a lot of issues with the combat alone to work through.

Also I never got around to adding spells, which were a major part of the story. Oh well.

(log in to comment)

Comments

My guess is data/items.txt has Windows line endings and this somehow confuses Python on non-Windows:


Traceback (most recent call last):
  File "main.py", line 116, in <module>
    pygame.all_items = eval(open("data/items.txt").read())
  File "<string>", line 1
    {
     ^
SyntaxError: invalid syntax

Doing open("data/items.txt").read().replace('\r\n', '\n') appears to have solved it but it's probably best to fix the file.
Huh, I'm not sure that's solved it... By clicking around I got this collection of exceptions and nothing seemed to really work:


Traceback (most recent call last):
  File "/Users/darabos/Downloads/PyWeek-11/powquest/lib/things.py", line 524, in execute
    getattr(self,command.replace(" ","_").lower())()
  File "main.py", line 60, in fight_test
    scene.children = [fight_scene(scene.children,[man],pygame.scene.enemies,pygame.bg,pygame.cur_scene["fight"])]
TypeError: __init__() takes at least 7 arguments (6 given)

/Users/darabos/Downloads/PyWeek-11/powquest/lib/fight_edit.py:3: RuntimeWarning: use scrap: No module named scrap
(ImportError: No module named scrap)
  pygame.scrap.init()
Traceback (most recent call last):
  File "/Users/darabos/Downloads/PyWeek-11/powquest/lib/things.py", line 524, in execute
    getattr(self,command.replace(" ","_").lower())()
  File "main.py", line 64, in edit_fight
    import lib.fight_edit
  File "/Users/darabos/Downloads/PyWeek-11/powquest/lib/fight_edit.py", line 3, in <module>
    pygame.scrap.init()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pygame/__init__.py", line 70, in __getattr__
    raise NotImplementedError(MissingPygameModule)
NotImplementedError: scrap module not available
(ImportError: No module named scrap)

Traceback (most recent call last):
  File "/Users/darabos/Downloads/PyWeek-11/powquest/lib/things.py", line 524, in execute
    getattr(self,command.replace(" ","_").lower())()
  File "main.py", line 58, in quit
    sys.exit()
SystemExit
Crap, I left the debug menu in :(

Ignore the menu, click on the textbox at the bottom. Also here is a version that has the menu removed and fixed items.txt:

http://code.google.com/p/powquest/downloads/detail?name=powquest_fix.zip&can=2&q=
Instead of doing .replace() you can just open the file with universal line endings, e.g.:

   pygame.all_items = eval(open("data/items.txt", "rU").read())
Nice, never knew about that feature. In fact I thought universal line endings was the default, which was why my code didn't deal with it in the first place.

Learn something new every day.

Anytime something gets killed (me or an enemy) the game crashes:

Traceback (most recent call last):
  File "main.py", line 213, in 
    game.update_children(dt)
  File "C:\Dev\pyweek11\powquest\lib\things.py", line 14, in
    [x.update_children(dt) for x in self.children]
  File "C:\Dev\pyweek11\powquest\lib\things.py", line 14, in
    [x.update_children(dt) for x in self.children]
  File "C:\Dev\pyweek11\powquest\lib\things.py", line 14, in
    [x.update_children(dt) for x in self.children]
  File "C:\Dev\pyweek11\powquest\lib\things.py", line 15, in
    self.update(dt)
  File "C:\Dev\pyweek11\powquest\lib\fight.py", line 380, in
    self.after(self)
  File "C:\Dev\pyweek11\powquest\lib\fight.py", line 562, in
    target.set_spot(None)
  File "C:\Dev\pyweek11\powquest\lib\fight.py", line 202, in
    if spot.contains:
AttributeError: 'NoneType' object has no attribute 'contains'

Btw, I could "sneak" past the first guard. Is that intented? ^^

Mh... I copied this to the beginning of

def set_spot(self,spot)
(line 202 in fight.py):

if not spot:
    return

Now the enemies get negative health before the "youwin"-screen appears, but it doesn't crash anymore. Nice game. :)

Thanks! Yes, sneaking is intended to be possible. Strange that I never encountered a death crash, I beat the game many times, but from the looks of it this bug should happen every time. And I don't remember making any untested changes at the last minute either.  Here is a better fix:

change

if spot.contains:
    return


to

if spot and spot.contains:
    return

Thanks for reporting!