Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from livewires import games,color
- import random
- class Bucket(games.Sprite):
- def update(self):
- self.x = games.mouse.x
- self.y = games.mouse.y
- self.check_collide()
- def check_collide(self):
- for myPizza in self.overlapping_sprites:
- myPizza.handle_collide()
- class Pizza(games.Sprite):
- def update(self):
- self.angle+=15
- self.y+=2
- if(self.y > games.screen.height):
- self.y = 100
- self.x = random.randint(10,games.screen.width-10)
- self.flag = True
- def handle_collide(self):
- self.y = 100
- self.x = random.randint(10,games.screen.width-10)
- class Chef(games.Sprite):
- def update(self):
- self.y=55
- self.x = random.randint(10,games.screen.width-10)
- #if myPizza.flag == True:
- #self.x = random.randint(10,games.screen.width-10)
- # myPizza.flag = False
- # myPizza.flag = False
- def handle_collide(self):
- self.y = 55
- #self.x = random.randint(10,games.screen.width-10)
- def main():
- games.init(screen_width = 640,screen_height = 480,fps = 50)
- wall = games.load_image("wall.jpg")
- games.screen.background = wall
- bucket = games.load_image("bucket.bmp")
- myBucket = Bucket(image = bucket,x = games.mouse.x,y = games.mouse.y)
- games.screen.add(myBucket)
- pizzaX = random.randint(1,games.screen.width)
- pizzaY = random.randint(1,games.screen.height)
- pizza = games.load_image("pizza.bmp")
- myPizza = Pizza(image = pizza,x = pizzaX,y = pizzaY)
- games.screen.add(myPizza)
- chef = games.load_image("chef.bmp")
- myChef = Chef(image = chef,x = 100,y = 55)
- games.screen.add(myChef)
- score = games.Text(value = 0,size = 60,color = color.black, x = 550,y = 30)
- games.screen.add(score)
- games.mouse.is_visible = False
- games.screen.event_grab = True
- games.screen.mainloop()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement