Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6093067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:31:03+00:00 2026-05-23T12:31:03+00:00

The game is simple where the Pan object catches the Pizza objects that are

  • 0

The game is simple where the Pan object catches the Pizza objects that are dispensed by the Chef object. When the Pan object (the user) misses a Pizza object, and it hits the floor of the screen, “Game Over” is printed (def game_over(self)) and the game terminates. But after the game terminates, my IDE gives me these error:

Traceback (most recent call last):
  File "C:\Users\COMPAQ\My Documents\Aptana Studio Workspace\Pythonic Things\PizzaPanicAttempt\PizzaPanicAttempt3.py", line 125, in <module>
    main()
  File "C:\Users\COMPAQ\My Documents\Aptana Studio Workspace\Pythonic Things\PizzaPanicAttempt\PizzaPanicAttempt3.py", line 124, in main
    games.screen.mainloop()
  File "C:\Python27\lib\site-packages\livewires\games.py", line 308, in mainloop
    object._tick() 
  File "C:\Python27\lib\site-packages\livewires\games.py", line 506, in _tick
    self.update()
  File "C:\Users\COMPAQ\My Documents\Aptana Studio Workspace\Pythonic Things\PizzaPanicAttempt\PizzaPanicAttempt3.py", line 67, in update
    self.check_collision()
  File "C:\Users\COMPAQ\My Documents\Aptana Studio Workspace\Pythonic Things\PizzaPanicAttempt\PizzaPanicAttempt3.py", line 72, in check_collision
    Pizza.handle_caught()
AttributeError: 'Pan' object has no attribute 'handle_caught'

The actual code for the program is as follows:

'''
Created on Jul 1, 2011

@author: ******** Louis
'''
#Watch me do.
from livewires import games, color
import random

games.init (screen_width = 640, screen_height = 480, fps = 50)

#Pizza Class
class Pizza (games.Sprite):
    pizzaimage = games.load_image ("pizza.bmp", transparent = True)
    def __init__(self, x, y = 90, dy = 4):
        super (Pizza, self).__init__(x = x, 
                                     y = y,
                                     image = Pizza.pizzaimage, 
                                     dy = dy)

    def update (self):
        if self.bottom>640:
            self.game_over()
            self.destroy()

    def handle_caught (self):
        self.destroy()

    def game_over (self):
        gameovermessage = games.Message(value = "Game Over",
                                         size = 90,
                                          color = color.red,
                                          x = 320,
                                          y = 240,
                                          lifetime = 250,
                                          after_death = games.screen.quit())
        games.screen.add(gameovermessage)

 #Pan/Cursorial Class       
class Pan (games.Sprite):
    panimage = games.load_image ("pan.bmp", transparent = True)
    def __init__ (self, x = games.mouse.x, y = games.mouse.y):
        super (Pan, self).__init__(x = x, 
                                   y = y, 
                                   image = Pan.panimage)
        self.score = 0
        self.textbox = games.Text (value = self.score,
                                    size = 20,
                                    color = color.black,
                                    x = 550,
                                    y = 50)
        games.screen.add(self.textbox)


    def update (self): #WWWWOW There is actually an *update* method
        self.x = games.mouse.x
        self.y = games.mouse.y

        if self.left < 0:
            self.left = 0
        if self.right >640:
            self.right = 640
        if self.top < 0:
            self.top = 0
        if self.bottom > 480:
            self.bottom = 480 
        self.check_collision()

    def check_collision (self):
        for Pizza in self.overlapping_sprites:
            self.textbox.value += 10
            Pizza.handle_caught()

#The Pizza Dispenser Class!
class Chef (games.Sprite):
    chefimage = games.load_image ("chef.bmp", transparent = True)
    def __init__(self, y = 55):
        super (Chef, self).__init__(x = 320, 
                                    y = y,
                                    dx = 2,
                                    image = Chef.chefimage)
        self.timervar = 0

    def update (self):
        if self.left < 0 or self.right > 640 or random.randrange(50) == 7:
            self.dx = -self.dx

        self.check_drop()

    def check_drop (self):
        if self.timervar > 0:
            self.timervar = self.timervar - 1
        else:
            le_pizza = Pizza (x = self.x)
            games.screen.add(le_pizza)
            self.timervar = 100

#main
def main():
    wallimage = games.load_image ("wall.jpg", transparent = True)
    games.screen.background = wallimage

    games.screen.add (Chef())

    games.screen.add (Pan())
    games.mouse.is_visible = False
    games.screen.event_grab = True

    games.screen.mainloop()

main()

#main
def main():
    wallbackground = games.load_image ("wall.jpg", transparent = False)
    games.screen.background = wallbackground

    games.screen.add(Chef())

    games.screen.add(Pan())
    games.mouse.is_visible = False
    games.screen.event_grab = True

    games.screen.mainloop()
main()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:31:04+00:00Added an answer on May 23, 2026 at 12:31 pm

    One of your self.overlapping_sprites is a Pan, not a Pizza.

    Also, you have two main()s.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing simple game on flex. In the game there are 2 objects
I have a fairly simple game that works perfectly on every version now up
ok well i have a simple game that uses really high of memory and
I'm developing a simple game that relies heavily on MoviePlayer and supporting both 4.0
i am developing simple game application just using pan gesture and cgaffinetransform rotate application
I am creating a simple game designed to prompt the user for the Greek
I'm trying to write a simple game in Java that uses Processing to render
I am making a simple game in order to learn a new language. I
I'm trying to write a simple game/utility to calculate poker odds. I know there's
I'm working on a very simple game (essentially an ice sliding puzzle), for now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.