Obb not working

Anyone have any idea why Obb isn't working for me? I'm on MacOSX 10.6 with Python 2.7 and PyGame 1.9.1. It crashes on startup with this:

Traceback (most recent call last):
  File "run_game.py", line 4, in <module>
    main.main()
  File "/Local/Games/PyWeek13/Unpack/obb-v4/src/main.py", line 53, in main
    con.think(dt, events, keys, mousepos, buttons)
  File "/Local/Games/PyWeek13/Unpack/obb-v4/src/play.py", line 81, in think
    tip.settip(self.choosetip(mousepos))
  File "/Local/Games/PyWeek13/Unpack/obb-v4/src/play.py", line 256, in choosetip
    return self.status.choosetip(mousepos)
  File "/Local/Games/PyWeek13/Unpack/obb-v4/src/status.py", line 224, in choosetip
    if self.brainrect.collidepoint(mousepos) or self.controlrect.collidepoint(mousepos):
AttributeError: 'Status' object has no attribute 'brainrect'

(log in to comment)

Comments

Yep, it's a bug. I have it fixed in version 5. Add the following to the end of status.Status.__init__ (that is, line 161 in status.py):


        self.brainrect = pygame.Rect(0,0,0,0)
        self.controlrect = pygame.Rect(0,0,0,0)

And while you're add it, add the following to line 13 of panel.py:


        self.cuberect = pygame.Rect(0,0,0,0)
        self.ncuberect = pygame.Rect(0,0,0,0)

Thanks for the report!
That's got it going, thanks.

Got another crash when trying to pause the game:

Traceback (most recent call last):
  File "run_game.py", line 4, in <module>
    main.main()
  File "/Local/Games/PyWeek13/Revisit/obb-v4/src/main.py", line 53, in main
    con.think(dt, events, keys, mousepos, buttons)
  File "/Local/Games/PyWeek13/Revisit/obb-v4/src/play.py", line 70, in think
    self.handleleftclick(mousepos)
  File "/Local/Games/PyWeek13/Revisit/obb-v4/src/play.py", line 174, in handleleftclick
    self.pause()
  File "/Local/Games/PyWeek13/Revisit/obb-v4/src/play.py", line 129, in pause
    self.pscreen = graphics.ghostify(vista._screen)
  File "/Local/Games/PyWeek13/Revisit/obb-v4/src/graphics.py", line 977, in ghostify
    arr = pygame.surfarray.pixels3d(img2)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/surfarray.py", line 167, in pixels3d
    return numpysf.pixels3d (surface)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/_numpysurfarray.py", line 221, in pixels3d
    raise ValueError("unsupported colormasks for 3D reference array")
ValueError: unsupported colormasks for 3D reference array
Okay I haven't seen that one before, and I'm not sure what causes it. I have two potential fixes. The first one is to add convert_alpha() to line 129 of src/play.py:


        self.pscreen = graphics.ghostify(vista._screen.convert_alpha())

Hopefully that will work. If not, src/fixes.py contains a function you wrote to solve a similar problem for pixels_alpha. The second potential fix involves writing a similar function for pixels3d and using that. But try the first potential fix first.
If you don't want to try the second potential fix, or you try it and it doesn't work, change line 129 of src/play.py to:


        self.pscreen = vista._screen.copy()

The screen won't be grayed out when you pause, but that's probably okay.
The convert_alpha() fix works, thanks.