Merge branch 'display' into interaction
This commit is contained in:
commit
6a8cc761a7
2 changed files with 57 additions and 29 deletions
|
@ -21,12 +21,14 @@ class GamePlay:
|
|||
self.menu_button = components.text_button("Menu", (250, 50), font=resources.FONT)
|
||||
self.counter_button = components.text_button("Counter", (250, 50), font=resources.FONT)
|
||||
self.food_button = components.text_button("Prepare", (250, 50), font=resources.FONT)
|
||||
self.getorder_button = components.text_button("Get Order", (250, 50), font=resources.FONT)
|
||||
self.serve_button = components.text_button("Serve", (250, 50), font=resources.FONT)
|
||||
self.drawer_button = components.text_button(".", (200, 75), font=resources.FONT)
|
||||
self.ham_button = components.SurfaceButton(resources.SUB_HAM_SPRITE_3X)
|
||||
self.tomato_button = components.SurfaceButton(resources.SUB_TOMATO_SPRITE_3X)
|
||||
self.lettuce_button = components.SurfaceButton(resources.SUB_LETTUCE_SPRITE_3X)
|
||||
self.top_button = components.SurfaceButton(resources.SUB_TOP_SPRITE_3X)
|
||||
self.status = "Counter"
|
||||
self.status = "Get Order"
|
||||
self.newOrder = True
|
||||
self.sandwichmade = False
|
||||
self.correctsandwich = []
|
||||
|
@ -77,7 +79,7 @@ class GamePlay:
|
|||
|
||||
def sandwich(self, screen):
|
||||
fillings = ["Lettuce", "Ham", "Tomatoes"]
|
||||
amountOfFilling = random.randrange(1,4)
|
||||
amountOfFilling = random.randrange(1,6)
|
||||
sandwich = ["Bread"]
|
||||
for _ in range(amountOfFilling):
|
||||
filling = random.randrange(0,3)
|
||||
|
@ -88,20 +90,35 @@ class GamePlay:
|
|||
|
||||
|
||||
def do(self):
|
||||
#print(self.status)
|
||||
if self.start == True:
|
||||
self.surface.fill("lightgreen")
|
||||
self.surface.blit(resources.COUNTER_SCREEN_IMAGE, (0, 0))
|
||||
self.start = False
|
||||
self.newOrder = False
|
||||
|
||||
|
||||
if self.menu_button.blit_onto(self.surface, (15, 5)):
|
||||
pygame.event.post(util.make_transition_event("menu"))
|
||||
|
||||
if self.status == "Counter" and self.sandwichmade == False:
|
||||
if self.status == "Serve":
|
||||
if self.food_button.blit_onto(self.surface, (1000, 5)):
|
||||
self.surface.fill("lightgreen")
|
||||
self.status = "Food"
|
||||
self.surface.blit(resources.SUB_BOTTOM_SPRITE_10X, (300, 350))
|
||||
else:
|
||||
self.surface.blit(resources.PREPARE_SCREEN_IMAGE, (0, 0))
|
||||
self.surface.blit(resources.SUB_BOTTOM_SPRITE_10X, (300, 300))
|
||||
print("click get food serve")
|
||||
elif self.status == "Counter" and self.sandwichmade == False:
|
||||
|
||||
if self.drawer_button.blit_onto(self.surface, (750, 465)):
|
||||
print("Drawer")
|
||||
if self.food_button.blit_onto(self.surface, (1000, 5)):
|
||||
self.surface.fill("lightgreen")
|
||||
self.status = "Food"
|
||||
self.surface.blit(resources.PREPARE_SCREEN_IMAGE, (0, 0))
|
||||
self.surface.blit(resources.SUB_BOTTOM_SPRITE_10X, (300, 300))
|
||||
print("click prepare counter")
|
||||
elif self.status == "Food":
|
||||
if self.counter_button.blit_onto(self.surface, (1000, 5)):
|
||||
self.surface.fill("lightgreen")
|
||||
self.character = components.Character(random.choice(resources.SCRIPT_ASK_SANDWICH))
|
||||
|
@ -109,17 +126,15 @@ class GamePlay:
|
|||
self.surface.blit(resources.COUNTER_SCREEN_IMAGE, (0, 0))
|
||||
self.status = "Counter"
|
||||
self.newOrder = True
|
||||
''' #swap status for different buttons
|
||||
if self.switch_button.blit_onto(self.surface, (1000, 5)):
|
||||
if self.status == "Counter" and self.sandwichmade == False:
|
||||
self.surface.fill("lightgreen")
|
||||
self.status = "Food"
|
||||
self.surface.blit(resources.SUB_BOTTOM_SPRITE_10X, (300, 350))
|
||||
else:
|
||||
self.surface.fill("lightgreen")
|
||||
print ("click counter from food")
|
||||
elif self.status == "Get Order":
|
||||
if self.getorder_button.blit_onto(self.surface, (1000, 5)):
|
||||
self.surface.blit(resources.COUNTER_SCREEN_IMAGE, (0, 0))
|
||||
GamePlay.sandwich(self, self.surface)
|
||||
self.status = "Counter"
|
||||
self.newOrder = True'''
|
||||
print ("click get order ")
|
||||
|
||||
|
||||
if self.status == "Food":
|
||||
if self.serve_button.blit_onto(self.surface, (10, 660)):
|
||||
self.status = "Serve"
|
||||
|
@ -129,20 +144,30 @@ class GamePlay:
|
|||
#serve
|
||||
|
||||
if self.correctsandwich == list(reversed(self.madesandwich)):
|
||||
self.surface.blit(
|
||||
if self.suspicion > 0:
|
||||
self.suspicion -= 1
|
||||
self.surface.blit(
|
||||
resources.FONT.render("Correct!!", True, (0, 0, 0)),
|
||||
(10, 10),
|
||||
(10, 60),
|
||||
)
|
||||
self.suspicion -= 1
|
||||
else:
|
||||
self.surface.blit(
|
||||
resources.FONT.render("Incorrect!!", True, (0, 0, 0)),
|
||||
(10, 10),
|
||||
)
|
||||
|
||||
self.suspicion += 1
|
||||
self.surface.blit(
|
||||
resources.FONT.render("Incorrect!!", True, (0, 0, 0)),
|
||||
(10, 60),
|
||||
)
|
||||
message = "Suspicion Levels: " + str(self.suspicion)
|
||||
self.surface.blit(
|
||||
resources.FONT.render(message, True, (0, 0, 0)),
|
||||
(10, 85),
|
||||
)
|
||||
self.madesandwich = ["Bread"]
|
||||
self.correctsandwich = []
|
||||
self.sandwichmade = False
|
||||
#self.status = "Get Order"
|
||||
#change to counter button
|
||||
#if suspician is over 5 then ooooooo game over?
|
||||
|
||||
if self.status == "Counter" and self.newOrder == True:
|
||||
GamePlay.sandwich(self, self.surface)
|
||||
|
@ -151,18 +176,20 @@ class GamePlay:
|
|||
GamePlay.displaysandwich(self.surface, self.correctsandwich)
|
||||
variationlr = random.randrange(0,15)
|
||||
variationud = random.randrange(0,15)
|
||||
if self.ham_button.blit_onto(self.surface, (100, 250)):
|
||||
self.surface.blit(resources.SUB_HAM_SPRITE_10X, (300 + variationlr, 350 + variationud))
|
||||
if self.ham_button.blit_onto(self.surface, (100, 200)):
|
||||
self.surface.blit(resources.SUB_HAM_SPRITE_10X, (300 + variationlr, 300 + variationud))
|
||||
self.madesandwich.append("Ham")
|
||||
elif self.tomato_button.blit_onto(self.surface, (250, 250)):
|
||||
self.surface.blit(resources.SUB_TOMATO_SPRITE_10X, (300 + variationlr, 350 + variationud))
|
||||
elif self.tomato_button.blit_onto(self.surface, (300, 200)):
|
||||
self.surface.blit(resources.SUB_TOMATO_SPRITE_10X, (300 + variationlr, 300 + variationud))
|
||||
self.madesandwich.append("Tomatoes")
|
||||
elif self.lettuce_button.blit_onto(self.surface, (400, 250)):
|
||||
self.surface.blit(resources.SUB_LETTUCE_SPRITE_10X, (300 + variationlr, 350 + variationud))
|
||||
elif self.lettuce_button.blit_onto(self.surface, (500, 200)):
|
||||
self.surface.blit(resources.SUB_LETTUCE_SPRITE_10X, (300 + variationlr, 300 + variationud))
|
||||
self.madesandwich.append("Lettuce")
|
||||
elif self.top_button.blit_onto(self.surface, (550, 250)):
|
||||
self.surface.blit(resources.SUB_TOP_SPRITE_10X, (300 + variationlr, 350 + variationud))
|
||||
elif self.top_button.blit_onto(self.surface, (700, 200)):
|
||||
self.surface.blit(resources.SUB_TOP_SPRITE_10X, (300 + variationlr, 300 + variationud))
|
||||
self.madesandwich.append("Bread")
|
||||
self.sandwichmade == True
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ FONT_XL = pygame.font.Font(RESOURCES_DIR / "Jersey10-Regular.ttf", size=100)
|
|||
|
||||
SPLASH_SCREEN_IMAGE = pygame.image.load(RESOURCES_DIR / "splash.png")
|
||||
COUNTER_SCREEN_IMAGE = pygame.image.load(RESOURCES_DIR / "counter.png")
|
||||
PREPARE_SCREEN_IMAGE = pygame.image.load(RESOURCES_DIR / "prepare.png")
|
||||
|
||||
SUB_TOMATO_SPRITE = pygame.image.load(RESOURCES_DIR / "sprites" / "sub_tomato.png")
|
||||
SUB_TOMATO_SPRITE_3X = pygame.transform.scale_by(SUB_TOMATO_SPRITE, 3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue