Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- init python:
- import random
- style.outlined_text = Style(style.default)
- style.outlined_text.color = "#d1b2b2"
- style.outlined_text.size = 40
- style.outlined_text.bold = True
- style.outlined_text.outlines = [(4, "#000000")]
- # Store last drop item
- def on_drop(drags, drop):
- if drags:
- print(f"Dropped: {drags.drag_name} on {drop}")
- store.last_drag = drags.drag_name
- print(f"Drop confirmed on cup!")
- if drop == "cup":
- if drags.drag_name == "Bottle":
- global bottle
- bottle += 1
- print(f"Bottle count: {bottle}")
- if drags.drag_name == "Lemon":
- global lemon
- lemon += 1
- print(f"Lemon count: {lemon}")
- if drags.drag_name == "Lime":
- global lime
- lime += 1
- print(f"Lime count: {lime}")
- return "The customer loved their [selected_drink]!"
- # Good drink definition
- def is_good_drink(selected_drink, bottle, lemon, lime):
- Correct = False
- if selected_drink == "Lemon Drop":
- if bottle == 1 and lemon == 1:
- Correct = True
- if selected_drink == "Mojito":
- if bottle == 1 and lime == 1:
- Correct = True
- if selected_drink == "Gin and Tonic":
- if bottle == 1 and lime == 1:
- Correct = True
- if selected_drink == "Tequila Sunrise":
- if bottle == 1 and lemon == 1:
- Correct = True
- if selected_drink == "Margarita":
- if bottle == 1 and lime == 1:
- Correct = True
- return Correct
- # MIXING DEFAULTS
- default all_ingredients = ["Bottle", "Lemon", "Lime"]
- define drink_recipes = {
- "Lemon Drop": set(("Bottle", "Lemon")),
- "Mojito": set(("Bottle", "Lime")),
- "Gin and Tonic": set(("Bottle", "Lime")),
- "Tequila Sunrise": set(("Bottle", "Lemon")),
- "Margarita": set(("Bottle", "Lime")),
- }
- default ingr_images = {
- "Lemon Drop": Image("images/minigame/lemondrop.png"),
- "Mojito": Image("images/minigame/mojito.png"),
- "Bottle": Image("images/minigame/bottle1.png"),
- "Lemon": Image("images/minigame/lemon1.png"),
- "Lime": Image("images/minigame/lime1.png"),
- }
- default ingr_sizes = {
- "Bottle": (432, 350),
- "Lemon": (200, 200),
- "Lime": (200, 200),
- }
- default on_bar = set()
- define bottle = 0
- define lemon = 0
- define lime = 0
- define cupFull = 0
- define last_drag = None
- # Flag to ensure the drink is made before selecting a new one
- define drink_ready = False
- # Initially select the drink
- define selected_drink = random.choice(list(drink_recipes.keys()))
- ## Remove
- label start:
- call screen mixing()
- label main_menu:
- return
- label evaluate_drink:
- if is_good_drink(selected_drink, bottle, lemon, lime):
- scene bg bar
- show expression "minigame/cup.png"
- "Wow! This is delicious!"
- $ drink_ready = True # Mark that the drink is finished
- return
- else:
- scene bg bar
- show expression "minigame/cup2.png"
- "Uh... this isn't right. Try again."
- call resetVal
- jump start
- label resetVal:
- # Reset variables
- $ bottle = 0
- $ lemon = 0
- $ lime = 0
- $ cupFull = 0
- $ last_drag = None
- label drink_loop:
- # Wait for a drop event
- $ renpy.pause(0.1)
- # Handle the drops
- if last_drag == "bottle":
- $ bottle += 1
- $ last_drag = None
- elif last_drag == "lemon":
- $ lemon += 1
- $ last_drag = None
- elif last_drag == "lime":
- $ lime += 1
- $ last_drag = None
- $ cupFull = bottle + lemon + lime
- $ renpy.debug("cupFull:" , cupFull)
- # When the cup is full, jump to evaluate the drink
- if cupFull >= 2: # Cup is full after 2 ingredients
- # Make sure to evaluate the drink once the cup is full
- if is_good_drink(selected_drink, bottle, lemon, lime):
- pc "Here's your drink."
- hide screen drink_screen
- jump evaluate_drink
- else:
- pc "Uh... this isn't right. Try again."
- jump start # Restart the mixing process
- return
- screen mixing():
- # If the drink isn't finished, don't select a new one
- if drink_ready:
- $ selected_drink = renpy.random.choice(list(drink_recipes.keys()))
- add "minigame/bg bar.png"
- text "The customer would like a [selected_drink]" style "outlined_text" pos (580, 15)
- text "Bottle: [bottle]" style "outlined_text" pos (1600, 600)
- text "Lemon: [lemon]" style "outlined_text" pos (1600, 700)
- text "Lime: [lime]" style "outlined_text" pos (1600, 800)
- text "Random Choice 1" style "outlined_text" pos (100, 600)
- text "Random Choice 2" style "outlined_text" pos (100, 700)
- text "Random Choice 3" style "outlined_text" pos (100, 800)
- draggroup:
- # Create drags for each ingredient with hardcoded positions
- drag:
- drag_name "Bottle" # Name of the ingredient
- draggable True
- droppable False
- pos (250, 75)
- xysize (225, 350) # Set the size of the ingredient image
- frame:
- background ingr_images["Bottle"] # Ingredient image
- drag:
- drag_name "Lemon" # Name of the ingredient
- draggable True
- droppable False
- pos (400, 75)
- xysize (180, 130) # Set the size of the ingredient image
- frame:
- background ingr_images["Lemon"] # Ingredient image
- drag:
- drag_name "Lime" # Name of the ingredient
- draggable True
- droppable False
- pos (600, 75)
- xysize (180, 130) # Set the size of the ingredient image
- frame:
- background ingr_images["Lime"] # Ingredient image
- # Create the cup drag (outside the loop)
- drag:
- drag_name "cup"
- draggable False
- droppable True
- pos (695, 540) # Position of the cup on the screen
- dropped on_drop
- xysize (432, 350) # Set the cup size
- frame:
- background Image("minigame/cup.png")
- return
Advertisement
Add Comment
Please, Sign In to add comment