Yennifart

Mini Mixology Game TEST

Dec 7th, 2025 (edited)
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.50 KB | None | 0 0
  1.  
  2. init python:
  3. import random
  4.  
  5. style.outlined_text = Style(style.default)
  6. style.outlined_text.color = "#d1b2b2"
  7. style.outlined_text.size = 40
  8. style.outlined_text.bold = True
  9. style.outlined_text.outlines = [(4, "#000000")]
  10.  
  11. # Store last drop item
  12. def on_drop(drags, drop):
  13. if drags:
  14. print(f"Dropped: {drags.drag_name} on {drop}")
  15. store.last_drag = drags.drag_name
  16. print(f"Drop confirmed on cup!")
  17. if drop == "cup":
  18. if drags.drag_name == "Bottle":
  19. global bottle
  20. bottle += 1
  21. print(f"Bottle count: {bottle}")
  22. if drags.drag_name == "Lemon":
  23. global lemon
  24. lemon += 1
  25. print(f"Lemon count: {lemon}")
  26. if drags.drag_name == "Lime":
  27. global lime
  28. lime += 1
  29. print(f"Lime count: {lime}")
  30. return "The customer loved their [selected_drink]!"
  31.  
  32.  
  33.  
  34. # Good drink definition
  35. def is_good_drink(selected_drink, bottle, lemon, lime):
  36. Correct = False
  37. if selected_drink == "Lemon Drop":
  38. if bottle == 1 and lemon == 1:
  39. Correct = True
  40.  
  41. if selected_drink == "Mojito":
  42. if bottle == 1 and lime == 1:
  43. Correct = True
  44.  
  45. if selected_drink == "Gin and Tonic":
  46. if bottle == 1 and lime == 1:
  47. Correct = True
  48.  
  49. if selected_drink == "Tequila Sunrise":
  50. if bottle == 1 and lemon == 1:
  51. Correct = True
  52.  
  53. if selected_drink == "Margarita":
  54. if bottle == 1 and lime == 1:
  55. Correct = True
  56. return Correct
  57.  
  58.  
  59. # MIXING DEFAULTS
  60. default all_ingredients = ["Bottle", "Lemon", "Lime"]
  61.  
  62. define drink_recipes = {
  63. "Lemon Drop": set(("Bottle", "Lemon")),
  64. "Mojito": set(("Bottle", "Lime")),
  65. "Gin and Tonic": set(("Bottle", "Lime")),
  66. "Tequila Sunrise": set(("Bottle", "Lemon")),
  67. "Margarita": set(("Bottle", "Lime")),
  68. }
  69.  
  70. default ingr_images = {
  71. "Lemon Drop": Image("images/minigame/lemondrop.png"),
  72. "Mojito": Image("images/minigame/mojito.png"),
  73. "Bottle": Image("images/minigame/bottle1.png"),
  74. "Lemon": Image("images/minigame/lemon1.png"),
  75. "Lime": Image("images/minigame/lime1.png"),
  76. }
  77.  
  78. default ingr_sizes = {
  79. "Bottle": (432, 350),
  80. "Lemon": (200, 200),
  81. "Lime": (200, 200),
  82. }
  83.  
  84. default on_bar = set()
  85.  
  86. define bottle = 0
  87. define lemon = 0
  88. define lime = 0
  89. define cupFull = 0
  90. define last_drag = None
  91.  
  92. # Flag to ensure the drink is made before selecting a new one
  93. define drink_ready = False
  94.  
  95. # Initially select the drink
  96. define selected_drink = random.choice(list(drink_recipes.keys()))
  97.  
  98. ## Remove
  99. label start:
  100. call screen mixing()
  101.  
  102.  
  103.  
  104. label main_menu:
  105. return
  106.  
  107. label evaluate_drink:
  108. if is_good_drink(selected_drink, bottle, lemon, lime):
  109. scene bg bar
  110. show expression "minigame/cup.png"
  111. "Wow! This is delicious!"
  112. $ drink_ready = True # Mark that the drink is finished
  113. return
  114. else:
  115. scene bg bar
  116. show expression "minigame/cup2.png"
  117. "Uh... this isn't right. Try again."
  118. call resetVal
  119. jump start
  120.  
  121. label resetVal:
  122. # Reset variables
  123. $ bottle = 0
  124. $ lemon = 0
  125. $ lime = 0
  126. $ cupFull = 0
  127. $ last_drag = None
  128.  
  129.  
  130. label drink_loop:
  131. # Wait for a drop event
  132. $ renpy.pause(0.1)
  133.  
  134. # Handle the drops
  135. if last_drag == "bottle":
  136. $ bottle += 1
  137. $ last_drag = None
  138.  
  139. elif last_drag == "lemon":
  140. $ lemon += 1
  141. $ last_drag = None
  142.  
  143. elif last_drag == "lime":
  144. $ lime += 1
  145. $ last_drag = None
  146.  
  147. $ cupFull = bottle + lemon + lime
  148. $ renpy.debug("cupFull:" , cupFull)
  149.  
  150. # When the cup is full, jump to evaluate the drink
  151. if cupFull >= 2: # Cup is full after 2 ingredients
  152. # Make sure to evaluate the drink once the cup is full
  153. if is_good_drink(selected_drink, bottle, lemon, lime):
  154. pc "Here's your drink."
  155. hide screen drink_screen
  156. jump evaluate_drink
  157. else:
  158. pc "Uh... this isn't right. Try again."
  159. jump start # Restart the mixing process
  160.  
  161.  
  162. return
  163.  
  164. screen mixing():
  165. # If the drink isn't finished, don't select a new one
  166. if drink_ready:
  167. $ selected_drink = renpy.random.choice(list(drink_recipes.keys()))
  168.  
  169.  
  170. add "minigame/bg bar.png"
  171. text "The customer would like a [selected_drink]" style "outlined_text" pos (580, 15)
  172.  
  173. text "Bottle: [bottle]" style "outlined_text" pos (1600, 600)
  174. text "Lemon: [lemon]" style "outlined_text" pos (1600, 700)
  175. text "Lime: [lime]" style "outlined_text" pos (1600, 800)
  176.  
  177. text "Random Choice 1" style "outlined_text" pos (100, 600)
  178. text "Random Choice 2" style "outlined_text" pos (100, 700)
  179. text "Random Choice 3" style "outlined_text" pos (100, 800)
  180.  
  181. draggroup:
  182. # Create drags for each ingredient with hardcoded positions
  183. drag:
  184. drag_name "Bottle" # Name of the ingredient
  185. draggable True
  186. droppable False
  187. pos (250, 75)
  188. xysize (225, 350) # Set the size of the ingredient image
  189.  
  190. frame:
  191. background ingr_images["Bottle"] # Ingredient image
  192.  
  193. drag:
  194. drag_name "Lemon" # Name of the ingredient
  195. draggable True
  196. droppable False
  197. pos (400, 75)
  198. xysize (180, 130) # Set the size of the ingredient image
  199.  
  200. frame:
  201. background ingr_images["Lemon"] # Ingredient image
  202.  
  203. drag:
  204. drag_name "Lime" # Name of the ingredient
  205. draggable True
  206. droppable False
  207. pos (600, 75)
  208. xysize (180, 130) # Set the size of the ingredient image
  209.  
  210. frame:
  211. background ingr_images["Lime"] # Ingredient image
  212.  
  213. # Create the cup drag (outside the loop)
  214. drag:
  215. drag_name "cup"
  216. draggable False
  217. droppable True
  218. pos (695, 540) # Position of the cup on the screen
  219. dropped on_drop
  220.  
  221. xysize (432, 350) # Set the cup size
  222. frame:
  223. background Image("minigame/cup.png")
  224. return
  225.  
  226.  
Advertisement
Add Comment
Please, Sign In to add comment