[Tutor] Pizza panic game
Alan Gauld
alan.gauld at btinternet.com
Sun Feb 5 01:16:55 CET 2012
On 04/02/12 23:43, myles broomes wrote:
> game comes up with an error and claims that the Spikey_ball object has
> no handle_caught attribute, but as you can see, it clearly does. Can
> anyone explain this to me?
Please post the entire error message, do not summarize.
There is often important information in the message.
Meantime can you try adding a print line in your last
method to check that the attribute(i.e. method) does
actually exist in the executing code at the point
of use?
ie.
def check_catch(self):
""" Check if catch pizzas. """
for pizza in self.overlapping_sprites:
>>>> print (dir(pizza)) #<<< new line
pizza.handle_caught()
hth,
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list