Yennifart

Mini mixology test again

Dec 9th, 2025
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.62 KB | None | 0 0
  1. init python:
  2. import random
  3.  
  4. # Define drink recipes (with ingredient quantities)
  5. drink_recipes = {
  6. "Lemon Drop": ["bottle" + "lemon"],
  7. "Mojito": ["bottle" + "lime"],
  8. "Gin and Tonic": ["bottle" + "lime"],
  9. "Tequila Sunrise": ["bottle" + "lemon"],
  10. "Margarita": ["bottle" + "lime"]
  11. }
  12.  
  13. # Initialize variables
  14. bottle = 0
  15. lemon = 0
  16. lime = 0
  17. cup_full = 0
  18. selected_drink = random.choice(list(drink_recipes.keys())) # Randomly pick a drink
  19.  
  20. # Function to check if the drink is correct (only correct ingredients)
  21. def is_good_drink():
  22. ingredients = drink_recipes[selected_drink]
  23. # Check if all ingredients in the cup are part of the selected drink
  24. if bottle == ingredients.count("bottle") and lemon == ingredients.count("lemon") and lime == ingredients.count("lime"):
  25. return True
  26. return False
  27.  
  28. # Store last dropped item
  29. def on_drop(drags, drop):
  30. global bottle, lemon, lime, cup_full
  31.  
  32. if drop == "cup":
  33. if drags.drag_name == "bottle":
  34. bottle += 1
  35. elif drags.drag_name == "lemon":
  36. lemon += 1
  37. elif drags.drag_name == "lime":
  38. lime += 1
  39.  
  40. cup_full = bottle + lemon + lime
  41.  
  42. # Check if the cup is full and if the drink is complete
  43. if cup_full >= 2: # A drink is considered complete with 2 ingredients
  44. if is_good_drink():
  45. return "Here's your drink! Enjoy!"
  46. else:
  47. return "This isn't right. Try again."
  48.  
  49. label drink_minigame:
  50.  
  51. scene bg bar
  52. with dissolve
  53.  
  54. # Reset variables
  55. $ bottle = 0
  56. $ lemon = 0
  57. $ lime = 0
  58. $ cupFull = 0
  59. $ last_drag = None
  60.  
  61. # Show the screen and enter loop
  62. show screen drink_screen
  63.  
  64. label drink_loop:
  65.  
  66. # Wait for a drop event
  67. $ renpy.pause(0.1)
  68.  
  69. # When the cup is full → evaluate drink
  70. if cupFull >= 2:
  71. hide screen drink_screen
  72. jump evaluate_drink
  73.  
  74. jump drink_loop
  75.  
  76. label evaluate_drink:
  77.  
  78. # Check if the drink is good (correct ingredients and quantities)
  79. if is_good_drink():
  80. scene bg bar
  81. show expression "minigame/cup.png"
  82. "Wow! This is delicious!"
  83. return
  84.  
  85. else:
  86. scene bg bar
  87. show expression "minigame/cup2.png"
  88. "Uh-oh! You added an incorrect ingredient or the quantities aren't right. Try again."
  89. # Reset all variables and jump back to drink minigame
  90. $ bottle = 0
  91. $ lemon = 0
  92. $ lime = 0
  93. $ cupFull = 0
  94. jump drink_minigame
  95.  
  96. screen drink_screen():
  97.  
  98. add "minigame/bg bar.png"
  99.  
  100. # Instructions
  101. text "Drop ingredients into the cup!" style "outlined_text" pos (475, 15)
  102.  
  103. text "Bottle: [bottle]" style "outlined_text" pos (1600, 600)
  104. text "Lemon: [lemon]" style "outlined_text" pos (1600, 650)
  105. text "Lime: [lime]" style "outlined_text" pos (1600, 700)
  106.  
  107. draggroup:
  108.  
  109. # Cup is the drop target
  110. drag:
  111. drag_name "cup"
  112. droppable True
  113. draggable False
  114. xalign 0.5
  115. yalign 0.7
  116. child "minigame/cup.png"
  117.  
  118. # Bottle
  119. drag:
  120. drag_name "bottle"
  121. draggable True
  122. droppable False
  123. xalign 0.2
  124. yalign 0.1
  125. frame:
  126. xysize (432, 432)
  127. idle_background "minigame/bottle1.png"
  128. hover_background "minigame/bottle2.png"
  129. selected_hover_background "minigame/bottle4.png"
  130. dragged on_drop
  131.  
  132. # Lemon
  133. drag:
  134. drag_name "lemon"
  135. draggable True
  136. droppable False
  137. xalign 0.35
  138. yalign 0.1
  139. frame:
  140. xysize (200, 200)
  141. idle_background "minigame/lemon1.png"
  142. hover_background im.Scale("minigame/lemon1.png", 220, 220)
  143. selected_hover_background "minigame/lemon2.png"
  144. dragged on_drop
  145.  
  146. # Lime
  147. drag:
  148. drag_name "lime"
  149. draggable True
  150. droppable False
  151. xalign 0.5
  152. yalign 0.1
  153. frame:
  154. xysize (200, 200)
  155. idle_background "minigame/lime1.png"
  156. hover_background im.Scale("minigame/lime1.png", 220, 220)
  157. selected_hover_background "minigame/lime2.png"
  158. dragged on_drop
  159.  
  160. return
  161.  
Advertisement
Add Comment
Please, Sign In to add comment