Delete joe.jpg
|
@ -72,15 +72,22 @@ def text_button(text, size, font=resources.FONT_SM) -> SurfaceButton:
|
|||
class Character:
|
||||
torso: pygame.Surface
|
||||
head: pygame.Surface
|
||||
glasses: pygame.Surface
|
||||
hair: pygame.Surface
|
||||
|
||||
headpos: int
|
||||
|
||||
def __init__(self):
|
||||
self.torso = random.choice(resources.CHARACTER_TORSOS)
|
||||
self.head = random.choice(resources.CHARACTER_HEADS)
|
||||
self.glasses = random.choice(resources.CHARACTER_GLASSES)
|
||||
self.hair = random.choice(resources.CHARACTER_HAIR)
|
||||
self.headpos = self.head.get_size()[1] * random.randint(6, 9) / 10
|
||||
|
||||
def blit_onto(self, output_surface: pygame.SurfaceType, pos: tuple[int, int]):
|
||||
output_surface.blit(self.torso, util.add_coord(pos, (0, self.headpos)))
|
||||
torso_centerpoint = util.center_within(self.torso.get_size(), self.head.get_size())
|
||||
output_surface.blit(self.head, util.add_coord(pos, (torso_centerpoint[0], 0)))
|
||||
if self.head not in resources.CHARACTER_HEADS[-2:]:
|
||||
output_surface.blit(self.glasses, util.add_coord(pos, (torso_centerpoint[0], 50)))
|
||||
output_surface.blit(self.hair, util.add_coord(pos, (torso_centerpoint[0], 0)))
|
||||
|
|
|
@ -13,6 +13,9 @@ class GamePlay:
|
|||
lettuce_button: components.SurfaceButton
|
||||
top_button: components.SurfaceButton
|
||||
|
||||
character: components.Character
|
||||
character_pos: tuple[int, int]
|
||||
|
||||
def __init__(self, surface):
|
||||
self.surface = surface
|
||||
self.menu_button = components.text_button("Menu", (250, 50), font=resources.FONT)
|
||||
|
@ -31,6 +34,9 @@ class GamePlay:
|
|||
self.start = True
|
||||
self.suspicion = 0
|
||||
|
||||
self.character = components.Character()
|
||||
self.character_pos = (400 + random.randint(0, 100), 100 + random.randint(25, 100))
|
||||
|
||||
def displaysandwich(screen, sandwich):
|
||||
position = 125
|
||||
picposition = 100
|
||||
|
@ -41,28 +47,28 @@ class GamePlay:
|
|||
(1110, position),
|
||||
)
|
||||
if start == 0:
|
||||
screen.blit(
|
||||
screen.blit(
|
||||
resources.TICKET_TOP_SPRITE_3X,
|
||||
(975, picposition),
|
||||
)
|
||||
start = 1
|
||||
elif i == "Lettuce":
|
||||
screen.blit(
|
||||
screen.blit(
|
||||
resources.TICKET_LETTUCE_SPRITE_3X,
|
||||
(992, picposition + 15),
|
||||
)
|
||||
elif i == "Ham":
|
||||
screen.blit(
|
||||
screen.blit(
|
||||
resources.TICKET_HAM_SPRITE_3X,
|
||||
(975, picposition - 2),
|
||||
)
|
||||
elif i == "Tomatoes":
|
||||
screen.blit(
|
||||
screen.blit(
|
||||
resources.TICKET_TOMATO_SPRITE_3X,
|
||||
(992, picposition + 15),
|
||||
)
|
||||
elif i == "Bread":
|
||||
screen.blit(
|
||||
screen.blit(
|
||||
resources.TICKET_BOTTOM_SPRITE_3X ,
|
||||
(975, picposition),
|
||||
)
|
||||
|
@ -86,7 +92,7 @@ class GamePlay:
|
|||
self.surface.fill("lightgreen")
|
||||
self.surface.blit(resources.COUNTER_SCREEN_IMAGE, (0, 0))
|
||||
self.start = False
|
||||
|
||||
|
||||
if self.menu_button.blit_onto(self.surface, (15, 5)):
|
||||
pygame.event.post(util.make_transition_event("menu"))
|
||||
|
||||
|
@ -97,6 +103,7 @@ class GamePlay:
|
|||
self.surface.blit(resources.SUB_BOTTOM_SPRITE_10X, (300, 350))
|
||||
else:
|
||||
if self.counter_button.blit_onto(self.surface, (1000, 5)):
|
||||
self.character.blit_onto(self.surface, self.character_pos)
|
||||
self.surface.fill("lightgreen")
|
||||
self.surface.blit(resources.COUNTER_SCREEN_IMAGE, (0, 0))
|
||||
self.status = "Counter"
|
||||
|
@ -121,13 +128,13 @@ class GamePlay:
|
|||
#serve
|
||||
|
||||
if self.correctsandwich == list(reversed(self.madesandwich)):
|
||||
self.surface.blit(
|
||||
self.surface.blit(
|
||||
resources.FONT.render("Correct!!", True, (0, 0, 0)),
|
||||
(10, 10),
|
||||
)
|
||||
self.suspicion -= 1
|
||||
else:
|
||||
self.surface.blit(
|
||||
self.surface.blit(
|
||||
resources.FONT.render("Incorrect!!", True, (0, 0, 0)),
|
||||
(10, 10),
|
||||
)
|
||||
|
|
|
@ -55,4 +55,20 @@ CHARACTER_HEADS = [
|
|||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_head_1.png"),
|
||||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_head_2.png"),
|
||||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_head_3.png"),
|
||||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_head_4.png"),
|
||||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_head_5.png"),
|
||||
]
|
||||
|
||||
CHARACTER_GLASSES = [
|
||||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_glasses_1.png"),
|
||||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_glasses_2.png"),
|
||||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_glasses_3.png"),
|
||||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_glasses_4.png"), # the blank one
|
||||
]
|
||||
|
||||
CHARACTER_HAIR = [
|
||||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_hair_1.png"),
|
||||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_hair_2.png"),
|
||||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_hair_3.png"),
|
||||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_hair_4.png"), # the bald one
|
||||
]
|
BIN
game/resources/sprites/character_glasses_1.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
game/resources/sprites/character_glasses_2.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
game/resources/sprites/character_glasses_3.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
game/resources/sprites/character_glasses_4.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
game/resources/sprites/character_hair_1.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
game/resources/sprites/character_hair_2.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
game/resources/sprites/character_hair_3.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
game/resources/sprites/character_hair_4.png
Normal file
After Width: | Height: | Size: 273 B |
BIN
game/resources/sprites/character_head_4.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
game/resources/sprites/character_head_5.png
Normal file
After Width: | Height: | Size: 25 KiB |