Guest User

Untitled

a guest
Nov 30th, 2025
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.14 KB | None | 0 0
  1. extends Button
  2.  
  3. @export var animation_name : String
  4. @onready var animation_player: AnimationPlayer = $"../../../../../../AnimationPlayer"
  5. @onready var teach_me_ui: CenterContainer = $"../../../.."
  6. @onready var timer: Timer = $Timer
  7. @onready var lilypads: HBoxContainer = $"../../../../../../Lily Pads/Lilypads"
  8. enum STATE {
  9. DELIA_ONE, #0
  10. PLAYER_ONE, #1
  11. DELIA_TWO, #2
  12. PLAYER_TWO, #3
  13. DELIA_ONE_TWO, #4
  14. PLAYER_ONE_TWO, #5
  15. DELIA_THREE, #6
  16. PLAYER_THREE, #7
  17. DELIA_FOUR, #8
  18. PLAYER_FOUR, #9
  19. DELIA_THREE_FOUR, #10
  20. PLAYER_THREE_FOUR, #11
  21. DELIA_ONE_TWO_THREE_FOUR, #12
  22. PLAYER_ONE_TWO_THREE_FOUR, #13
  23. DELIA_FIVE, #14
  24. PLAYER_FIVE, #15
  25. DELIA_SIX, #16
  26. PLAYER_SIX, #17
  27. DELIA_FIVE_SIX, #18
  28. PLAYER_FIVE_SIX, #19
  29. DELIA_ONE_TWO_THRE_FOUR_FIVE_SIX, #20
  30. PLAYER_ONE_TWO_THREE_FOUR_FIVE_SIX, #21
  31. DELIA_SEVEN, #22
  32. PLAYER_SEVEN, #23
  33. DELIA_EIGHT, #24
  34. PLAYER_EIGHT, #25
  35. DELIA_SEVEN_EIGHT, #26
  36. PLAYER_SEVEN_EIGHT, #27
  37. DELIA_FIVE_SIX_SEVEN_EIGHT, #28
  38. PLAYER_FIVE_SIX_SEVEN_EIGHT, #29
  39. DELIA_WHOLE, #30
  40. PLAYER_WHOLE #31
  41. }
  42. @export var step : STATE #: set = state_debug
  43. #HI FUTURE ME:
  44. #Use Global.lilypad_clickability.emit(true) to turn the lilypads on and off
  45. enum PITCH{C, D, E, F, G, A, B, HIC}
  46. var current_pitch : PITCH
  47. var pitch_index : int
  48. @export var first_pitch_song_array : Array[PITCH]
  49. @export var second_pitch_song_array : Array[PITCH]
  50. @export var third_pitch_song_array : Array[PITCH]
  51. @export var fourth_pitch_song_array : Array[PITCH]
  52. @export var fifth_pitch_song_array : Array[PITCH]
  53. @export var sixth_pitch_song_array : Array[PITCH]
  54. @export var seventh_pitch_song_array : Array[PITCH]
  55. @export var eighth_pitch_song_array : Array[PITCH]
  56. var current_array : Array
  57.  
  58. func _ready() -> void:
  59. for x in lilypads.get_children():
  60. x.pad_pitch.connect(_pad_pitch)
  61.  
  62. func _pad_pitch(pressed_pad):
  63. if Global.teach_me_mode:
  64. if pressed_pad == current_array[pitch_index]:
  65. print("CORRECT")
  66. pitch_index = pitch_index + 1
  67. else:
  68. #the player has messed up
  69. pitch_index = 0
  70. print("MESSED UP")
  71. #Let Delia instruct again
  72. #Back the state up
  73. step = step - 1
  74. Global.lilypad_clickability.emit(true)
  75. Global.show_dialog.emit("Hold on,\nIt's like this")
  76. timer.start()
  77. await timer.timeout
  78. await delia_plays()
  79. if pitch_index == current_array.size():
  80. print("COMPLETED")
  81. pitch_index = 0
  82. step = step + 1
  83. Global.show_dialog.emit("You got it!")
  84. Global.lilypad_clickability.emit(true)
  85. timer.start()
  86. await timer.timeout
  87. Global.show_dialog.emit("My turn")
  88. await delia_plays()
  89. get_a_new_array()
  90.  
  91. #func _on_never_mind_pressed() -> void:
  92. #Global.teach_me_mode = false
  93. #visible = false
  94. #Global.show_button.emit()
  95.  
  96. func _on_pressed() -> void:
  97. pitch_index = 0
  98. teach_me_ui.visible = false
  99. step = STATE.DELIA_ONE
  100. Global.show_dialog.emit("Watch me!")
  101. Global.lilypad_clickability.emit(true)
  102. await delia_plays()
  103. get_a_new_array()
  104.  
  105. func delia_plays():
  106. #turn off the lilypads
  107. match step:
  108. STATE.DELIA_ONE:
  109. animation_player.play_section_with_markers(animation_name, "First", "Second")
  110. print("State: Delia One")
  111. STATE.DELIA_TWO:
  112. animation_player.play_section_with_markers(animation_name, "Second", "Third")
  113. print("State: Delia Two")
  114. STATE.DELIA_ONE_TWO:
  115. animation_player.play_section_with_markers(animation_name, "First", "Third")
  116. print("State: Delia One Two")
  117. STATE.DELIA_THREE:
  118. animation_player.play_section_with_markers(animation_name, "Third", "Fourth")
  119. print("State: Delia Three")
  120. STATE.DELIA_FOUR:
  121. animation_player.play_section_with_markers(animation_name, "Fourth", "Fifth")
  122. print("State: Delia Four")
  123. STATE.DELIA_THREE_FOUR:
  124. animation_player.play_section_with_markers(animation_name, "Third", "Fifth")
  125. print("State: Delia Three Four")
  126. STATE.DELIA_ONE_TWO_THREE_FOUR:
  127. animation_player.play_section_with_markers(animation_name, "First", "Fifth")
  128. print("State: Delia One Two Three Four")
  129. STATE.DELIA_FIVE:
  130. animation_player.play_section_with_markers(animation_name, "Fifth", "Sixth")
  131. print("State: Delia Five")
  132. STATE.DELIA_SIX:
  133. animation_player.play_section_with_markers(animation_name, "Sixth", "Seventh")
  134. print("State: Delia Six")
  135. STATE.DELIA_FIVE_SIX:
  136. animation_player.play_section_with_markers(animation_name, "Fifth", "Seventh")
  137. print("State: Delia Five Six")
  138. STATE.DELIA_ONE_TWO_THRE_FOUR_FIVE_SIX:
  139. animation_player.play_section_with_markers(animation_name, "First", "Seventh")
  140. print("State: Delia One Two Three Four Five Six")
  141. STATE.DELIA_SEVEN:
  142. animation_player.play_section_with_markers(animation_name, "Seventh", "Eighth")
  143. print("State: Delia Seven")
  144. STATE.DELIA_EIGHT:
  145. animation_player.play_section_with_markers(animation_name, "Eighth", "Ninth")
  146. print("State: Delia Eight")
  147. STATE.DELIA_SEVEN_EIGHT:
  148. animation_player.play_section_with_markers(animation_name, "Seventh", "Ninth")
  149. print("State: Delia Seven Eight")
  150. STATE.DELIA_FIVE_SIX_SEVEN_EIGHT:
  151. animation_player.play_section_with_markers(animation_name, "Fifth", "Ninth")
  152. print("State: Delia Five Six Seven Eight")
  153. STATE.DELIA_WHOLE:
  154. animation_player.play_section_with_markers(animation_name, "First", "Ninth")
  155. print("State: Delia Wholes")
  156. print("There should be an animation here")
  157. await animation_player.animation_finished
  158. #turn the lilypads back on
  159. Global.lilypad_clickability.emit(false)
  160. Global.show_dialog.emit("Your turn!")
  161. #Advance the step
  162. step = step + 1
  163.  
  164. func get_a_new_array():
  165. current_array.clear()
  166. match step:
  167. STATE.PLAYER_ONE:
  168. current_array += first_pitch_song_array
  169. print("State: Player One")
  170. STATE.PLAYER_TWO:
  171. current_array += second_pitch_song_array
  172. print("State: Player Two")
  173. STATE.PLAYER_ONE_TWO:
  174. current_array += first_pitch_song_array
  175. current_array += second_pitch_song_array
  176. print("State: Player One Two")
  177. STATE.PLAYER_THREE:
  178. current_array += third_pitch_song_array
  179. print("State: Player Three")
  180. STATE.PLAYER_FOUR:
  181. current_array += fourth_pitch_song_array
  182. print("State: Player Four")
  183. STATE.PLAYER_THREE_FOUR:
  184. current_array += third_pitch_song_array
  185. current_array += fourth_pitch_song_array
  186. print("State: Player Three Four")
  187. STATE.PLAYER_ONE_TWO_THREE_FOUR:
  188. current_array += first_pitch_song_array
  189. current_array += second_pitch_song_array
  190. current_array += third_pitch_song_array
  191. current_array += fourth_pitch_song_array
  192. print("State: Player One Two Three Four")
  193. STATE.PLAYER_FIVE:
  194. current_array += fifth_pitch_song_array
  195. print("State: Player Five")
  196. STATE.PLAYER_SIX:
  197. current_array += sixth_pitch_song_array
  198. print("State: Player Six")
  199. STATE.PLAYER_FIVE_SIX:
  200. current_array += fifth_pitch_song_array
  201. current_array += sixth_pitch_song_array
  202. print("State: Player Five Six")
  203. STATE.PLAYER_ONE_TWO_THREE_FOUR_FIVE_SIX:
  204. current_array += first_pitch_song_array
  205. current_array += second_pitch_song_array
  206. current_array += third_pitch_song_array
  207. current_array += fourth_pitch_song_array
  208. current_array += fifth_pitch_song_array
  209. current_array += sixth_pitch_song_array
  210. print("State: Player One Two Three Four Five Six")
  211. STATE.PLAYER_SEVEN:
  212. current_array += seventh_pitch_song_array
  213. print("State: Player Seven")
  214. STATE.PLAYER_EIGHT:
  215. current_array += eighth_pitch_song_array
  216. print("State: Player Eight")
  217. STATE.PLAYER_SEVEN_EIGHT:
  218. current_array += seventh_pitch_song_array
  219. current_array += eighth_pitch_song_array
  220. print("State: Player Seven Eight")
  221. STATE.PLAYER_FIVE_SIX_SEVEN_EIGHT:
  222. current_array += fifth_pitch_song_array
  223. current_array += sixth_pitch_song_array
  224. current_array += seventh_pitch_song_array
  225. current_array += eighth_pitch_song_array
  226. print("State: Player Five Six Seven Eight")
  227. STATE.PLAYER_WHOLE:
  228. current_array += first_pitch_song_array
  229. current_array += second_pitch_song_array
  230. current_array += third_pitch_song_array
  231. current_array += fourth_pitch_song_array
  232. current_array += fifth_pitch_song_array
  233. current_array += sixth_pitch_song_array
  234. current_array += seventh_pitch_song_array
  235. current_array += eighth_pitch_song_array
  236. print("Player Whole")
  237.  
Advertisement
Add Comment
Please, Sign In to add comment