Merge remote-tracking branch 'origin/display' into menu
This commit is contained in:
commit
065cd235f8
2 changed files with 29 additions and 8 deletions
|
@ -6,13 +6,22 @@ import random
|
|||
|
||||
class GamePlay:
|
||||
surface: pygame.SurfaceType
|
||||
play_button: components.Button
|
||||
play_button: components.SurfaceButton
|
||||
ham_button: components.SurfaceButton
|
||||
tomato_button: components.SurfaceButton
|
||||
lettuce_button: components.SurfaceButton
|
||||
top_button: components.SurfaceButton
|
||||
|
||||
def __init__(self, surface):
|
||||
self.surface = surface
|
||||
self.play_button = components.Button("Switch", (250, 50))
|
||||
self.play_button = components.text_button("Switch", (250, 50), font=resources.FONT)
|
||||
self.ham_button = components.SurfaceButton(resources.SUB_TOMATO_SPRITE)
|
||||
self.tomato_button = components.SurfaceButton(resources.SUB_TOMATO_SPRITE)
|
||||
self.lettuce_button = components.SurfaceButton(resources.SUB_TOMATO_SPRITE)
|
||||
self.top_button = components.SurfaceButton(resources.SUB_TOMATO_SPRITE)
|
||||
self.status = "Counter"
|
||||
self.orderUp = False
|
||||
self.newOrder = True
|
||||
self.sandwichmade = False
|
||||
|
||||
def sandwich(screen):
|
||||
fillings = ["lettuce", "ham", "tomatoes"]
|
||||
|
@ -31,6 +40,7 @@ class GamePlay:
|
|||
position += 50
|
||||
|
||||
def do(self):
|
||||
#self.surface.blit(resources.SPLASH_SCREEN_IMAGE, (0, 0))
|
||||
#width = self.get_width()
|
||||
#height = self.get_height()
|
||||
#gap = 15
|
||||
|
@ -38,7 +48,7 @@ class GamePlay:
|
|||
|
||||
if self.play_button.blit_onto(self.surface, (1000, 10)):
|
||||
#status = "Food"
|
||||
if self.status == "Counter":
|
||||
if self.status == "Counter" and self.sandwichmade == False:
|
||||
self.surface.fill("blue")
|
||||
self.surface.blit(
|
||||
resources.FONT.render("Food", True, (0, 0, 0)),
|
||||
|
@ -53,9 +63,19 @@ class GamePlay:
|
|||
(100, 100),
|
||||
)
|
||||
self.status = "Counter"
|
||||
self.orderUp = False
|
||||
self.newOrder = True
|
||||
|
||||
if self.status == "Counter" and self.orderUp == False:
|
||||
if self.status == "Counter" and self.newOrder == True:
|
||||
GamePlay.sandwich(self.surface)
|
||||
self.orderUp = True
|
||||
self.newOrder = False
|
||||
elif self.status == "Food":
|
||||
if self.ham_button.blit_onto(self.surface, (100, 250)):
|
||||
print("HAM!")
|
||||
elif self.tomato_button.blit_onto(self.surface, (250, 250)):
|
||||
print("TOMATO!")
|
||||
elif self.lettuce_button.blit_onto(self.surface, (400, 250)):
|
||||
print("LETTUCE!")
|
||||
elif self.top_button.blit_onto(self.surface, (550, 250)):
|
||||
print("TOP!")
|
||||
self.sandwichmade == True
|
||||
|
||||
|
|
|
@ -13,4 +13,5 @@ FONT_XL = pygame.font.Font(RESOURCES_DIR / "Jersey10-Regular.ttf", size=100)
|
|||
|
||||
SPLASH_SCREEN_IMAGE = pygame.image.load(RESOURCES_DIR / "splash.png")
|
||||
|
||||
TICKET_TOMATO_SPRITE = pygame.image.load(RESOURCES_DIR / "sprits" / "ticket_tomato.png")
|
||||
SUB_TOMATO_SPRITE = pygame.image.load(RESOURCES_DIR / "sprites" / "sub_tomato.png")
|
||||
TICKET_TOMATO_SPRITE_2X = pygame.transform.scale_by(SUB_TOMATO_SPRITE, 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue