Alter 6 files
Update __main__.py Update gameplay.py Update menu.py Update resources.py Add game-over.txt Add character_glasses_5.png
This commit is contained in:
parent
e6207ad820
commit
f5849c6a09
6 changed files with 42 additions and 0 deletions
|
@ -25,6 +25,8 @@ def main():
|
|||
active_scene = menu.Menu(screen)
|
||||
case "gameplay":
|
||||
active_scene = gameplay.GamePlay(screen)
|
||||
case "gameover":
|
||||
active_scene = menu.GameOver(screen)
|
||||
case _:
|
||||
raise NotImplementedError("switch to scene " + event.dict["to"])
|
||||
screen.fill(0x000000)
|
||||
|
|
|
@ -174,6 +174,8 @@ class GamePlay:
|
|||
resources.FONT.render(message, True, (0, 0, 0)),
|
||||
(10, 85),
|
||||
)
|
||||
if self.suspicion == 3:
|
||||
pygame.event.post(util.make_transition_event("gameover"))
|
||||
self.madesandwich = ["Bread"]
|
||||
self.correctsandwich = []
|
||||
self.sandwichmade = False
|
||||
|
|
31
game/menu.py
31
game/menu.py
|
@ -2,6 +2,8 @@ import pygame
|
|||
import resources
|
||||
import components
|
||||
import util
|
||||
import random
|
||||
|
||||
|
||||
class Menu:
|
||||
surface: pygame.SurfaceType
|
||||
|
@ -31,3 +33,32 @@ class Menu:
|
|||
|
||||
if self.quit_button.blit_onto(self.surface, util.add_coord(central_button_block, (0, 50 + gap))):
|
||||
pygame.event.post(pygame.event.Event(pygame.QUIT))
|
||||
|
||||
|
||||
class GameOver:
|
||||
surface: pygame.SurfaceType
|
||||
quit_button: components.SurfaceButton
|
||||
desc: str
|
||||
|
||||
def __init__(self, surface):
|
||||
self.surface = surface
|
||||
self.quit_button = components.text_button(":(", (250, 50), font=resources.FONT)
|
||||
self.desc = random.choice(resources.SCRIPT_GAME_OVER)
|
||||
|
||||
def do(self):
|
||||
# self.surface.blit(resources.SPLASH_SCREEN_IMAGE, (0, 0))
|
||||
self.surface.fill(0xff0000)
|
||||
|
||||
title_text = "YOU LOSE"
|
||||
self.surface.blit(
|
||||
resources.FONT_XL.render(title_text, True, "black"),
|
||||
util.add_coord(util.center_within(self.surface.get_size(), resources.FONT_XL.size(title_text)), (0, -200)),
|
||||
)
|
||||
|
||||
util.render_text_centred_at(self.desc, resources.FONT, 0x000000, *util.add_coord(util.center_within(self.surface.get_size(), (1, 1)), (0, -100)), self.surface, self.surface.get_size()[0]*0.8)
|
||||
|
||||
gap = 15
|
||||
central_button_block = util.center_within(self.surface.get_size(), (250, 50))
|
||||
|
||||
if self.quit_button.blit_onto(self.surface, util.add_coord(central_button_block, (0, 50 + gap))):
|
||||
pygame.event.post(pygame.event.Event(pygame.QUIT))
|
||||
|
|
|
@ -65,6 +65,7 @@ CHARACTER_GLASSES = [
|
|||
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
|
||||
pygame.image.load(RESOURCES_DIR / "sprites" / "character_glasses_5.png"),
|
||||
]
|
||||
|
||||
CHARACTER_HAIR = [
|
||||
|
@ -79,3 +80,4 @@ EMPTY_NOTE = pygame.image.load(RESOURCES_DIR / "empty_note.png")
|
|||
SCRIPT_ASK_SANDWICH = open(RESOURCES_DIR / "scripts" / "ask-sandwich.txt").read().strip().splitlines()
|
||||
SCRIPT_TAKE_SANDWICH = open(RESOURCES_DIR / "scripts" / "take-sandwich.txt").read().strip().splitlines()
|
||||
SCRIPT_TAKE_SANDWICH_RUDE = open(RESOURCES_DIR / "scripts" / "take-sandwich-rude.txt").read().strip().splitlines()
|
||||
SCRIPT_GAME_OVER = open(RESOURCES_DIR / "scripts" / "game-over.txt").read().strip().splitlines()
|
5
game/resources/scripts/game-over.txt
Normal file
5
game/resources/scripts/game-over.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
Your nervous glances and constant fidgeting raised too many red flags, and the gang quickly saw through your act.
|
||||
You stuck out like a sore thumb, and your suspicious behavior tipped off the gang, leading to you being caught.
|
||||
You were too obvious in your attempts to blend in, and the gang sniffed you out in no time.
|
||||
Your over-the-top secrecy and awkward questions made you a target, and the gang uncovered your true intentions.
|
||||
You thought you were being stealthy, but your suspicious movements gave you away, and the gang was onto you in seconds.
|
BIN
game/resources/sprites/character_glasses_5.png
Normal file
BIN
game/resources/sprites/character_glasses_5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Loading…
Add table
Add a link
Reference in a new issue