On Jun 7, 3:13 pm, GTM9 <[email protected]> wrote:
> Here's the link to the source and required resources:
>
> http://www.sendspace.com/file/0dbxnw
>
> Could someone please help me fix the problem?
I didn't test this extensively, but one problem might be here:
if self.result_phase:
if self[key.H]:
game.change_scene(Scene_Menu())
# for b in bullets: b.update(dt)
return
As you can see, I commented out
for b in bullets: b.update(dt).
I'm not sure if there's a good reason for updating the bullet after
game.change_scene() is called. In any case, this gets you to the next
menu scenes, but when you start the next game, it errors out with:
File "C:\Documents and Settings\GO\My Documents\Downloads
\Ship_Showdown Problem\Game.py", line 39, in update
self.scene.update(dt)
File "ShipShowdown.py", line 85, in update
b.update(dt)
File "C:\Documents and Settings\GO\My Documents\Downloads
\Ship_Showdown Problem\bullet.py", line 36, in update
self.x += self.dx * dt
File "c:\python25\lib\site-packages\pyglet\sprite.py", line 442, in
_set_x
self._update_position()
File "c:\python25\lib\site-packages\pyglet\sprite.py", line 382, in
_update_position
x1 = -img.anchor_x * self._scale
AttributeError: 'NoneType' object has no attribute 'anchor_x'
I think what's happening is the update is being called before the
bullet actually exists. Sorry I don't have time to investigate further
-- I should note that you comment out the delete methods in the game's
on_exit(), you can play through fine (though of course the bullets not
deleted hit the opponent in the next game ;) ).
Also, by commenting out the 'for b in bullets', you'll notice that the
player 2 ship image is reversed when the next game starts. Odd, no?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---