Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Button
- @export var animation_name : String
- @onready var animation_player: AnimationPlayer = $"../../../../../../AnimationPlayer"
- @onready var teach_me_ui: CenterContainer = $"../../../.."
- @onready var timer: Timer = $Timer
- @onready var lilypads: HBoxContainer = $"../../../../../../Lily Pads/Lilypads"
- enum STATE {
- DELIA_ONE, #0
- PLAYER_ONE, #1
- DELIA_TWO, #2
- PLAYER_TWO, #3
- DELIA_ONE_TWO, #4
- PLAYER_ONE_TWO, #5
- DELIA_THREE, #6
- PLAYER_THREE, #7
- DELIA_FOUR, #8
- PLAYER_FOUR, #9
- DELIA_THREE_FOUR, #10
- PLAYER_THREE_FOUR, #11
- DELIA_ONE_TWO_THREE_FOUR, #12
- PLAYER_ONE_TWO_THREE_FOUR, #13
- DELIA_FIVE, #14
- PLAYER_FIVE, #15
- DELIA_SIX, #16
- PLAYER_SIX, #17
- DELIA_FIVE_SIX, #18
- PLAYER_FIVE_SIX, #19
- DELIA_ONE_TWO_THRE_FOUR_FIVE_SIX, #20
- PLAYER_ONE_TWO_THREE_FOUR_FIVE_SIX, #21
- DELIA_SEVEN, #22
- PLAYER_SEVEN, #23
- DELIA_EIGHT, #24
- PLAYER_EIGHT, #25
- DELIA_SEVEN_EIGHT, #26
- PLAYER_SEVEN_EIGHT, #27
- DELIA_FIVE_SIX_SEVEN_EIGHT, #28
- PLAYER_FIVE_SIX_SEVEN_EIGHT, #29
- DELIA_WHOLE, #30
- PLAYER_WHOLE #31
- }
- @export var step : STATE #: set = state_debug
- #HI FUTURE ME:
- #Use Global.lilypad_clickability.emit(true) to turn the lilypads on and off
- enum PITCH{C, D, E, F, G, A, B, HIC}
- var current_pitch : PITCH
- var pitch_index : int
- @export var first_pitch_song_array : Array[PITCH]
- @export var second_pitch_song_array : Array[PITCH]
- @export var third_pitch_song_array : Array[PITCH]
- @export var fourth_pitch_song_array : Array[PITCH]
- @export var fifth_pitch_song_array : Array[PITCH]
- @export var sixth_pitch_song_array : Array[PITCH]
- @export var seventh_pitch_song_array : Array[PITCH]
- @export var eighth_pitch_song_array : Array[PITCH]
- var current_array : Array
- func _ready() -> void:
- for x in lilypads.get_children():
- x.pad_pitch.connect(_pad_pitch)
- func _pad_pitch(pressed_pad):
- if Global.teach_me_mode:
- if pressed_pad == current_array[pitch_index]:
- print("CORRECT")
- pitch_index = pitch_index + 1
- else:
- #the player has messed up
- pitch_index = 0
- print("MESSED UP")
- #Let Delia instruct again
- #Back the state up
- step = step - 1
- Global.lilypad_clickability.emit(true)
- Global.show_dialog.emit("Hold on,\nIt's like this")
- timer.start()
- await timer.timeout
- await delia_plays()
- if pitch_index == current_array.size():
- print("COMPLETED")
- pitch_index = 0
- step = step + 1
- Global.show_dialog.emit("You got it!")
- Global.lilypad_clickability.emit(true)
- timer.start()
- await timer.timeout
- Global.show_dialog.emit("My turn")
- await delia_plays()
- get_a_new_array()
- #func _on_never_mind_pressed() -> void:
- #Global.teach_me_mode = false
- #visible = false
- #Global.show_button.emit()
- func _on_pressed() -> void:
- pitch_index = 0
- teach_me_ui.visible = false
- step = STATE.DELIA_ONE
- Global.show_dialog.emit("Watch me!")
- Global.lilypad_clickability.emit(true)
- await delia_plays()
- get_a_new_array()
- func delia_plays():
- #turn off the lilypads
- match step:
- STATE.DELIA_ONE:
- animation_player.play_section_with_markers(animation_name, "First", "Second")
- print("State: Delia One")
- STATE.DELIA_TWO:
- animation_player.play_section_with_markers(animation_name, "Second", "Third")
- print("State: Delia Two")
- STATE.DELIA_ONE_TWO:
- animation_player.play_section_with_markers(animation_name, "First", "Third")
- print("State: Delia One Two")
- STATE.DELIA_THREE:
- animation_player.play_section_with_markers(animation_name, "Third", "Fourth")
- print("State: Delia Three")
- STATE.DELIA_FOUR:
- animation_player.play_section_with_markers(animation_name, "Fourth", "Fifth")
- print("State: Delia Four")
- STATE.DELIA_THREE_FOUR:
- animation_player.play_section_with_markers(animation_name, "Third", "Fifth")
- print("State: Delia Three Four")
- STATE.DELIA_ONE_TWO_THREE_FOUR:
- animation_player.play_section_with_markers(animation_name, "First", "Fifth")
- print("State: Delia One Two Three Four")
- STATE.DELIA_FIVE:
- animation_player.play_section_with_markers(animation_name, "Fifth", "Sixth")
- print("State: Delia Five")
- STATE.DELIA_SIX:
- animation_player.play_section_with_markers(animation_name, "Sixth", "Seventh")
- print("State: Delia Six")
- STATE.DELIA_FIVE_SIX:
- animation_player.play_section_with_markers(animation_name, "Fifth", "Seventh")
- print("State: Delia Five Six")
- STATE.DELIA_ONE_TWO_THRE_FOUR_FIVE_SIX:
- animation_player.play_section_with_markers(animation_name, "First", "Seventh")
- print("State: Delia One Two Three Four Five Six")
- STATE.DELIA_SEVEN:
- animation_player.play_section_with_markers(animation_name, "Seventh", "Eighth")
- print("State: Delia Seven")
- STATE.DELIA_EIGHT:
- animation_player.play_section_with_markers(animation_name, "Eighth", "Ninth")
- print("State: Delia Eight")
- STATE.DELIA_SEVEN_EIGHT:
- animation_player.play_section_with_markers(animation_name, "Seventh", "Ninth")
- print("State: Delia Seven Eight")
- STATE.DELIA_FIVE_SIX_SEVEN_EIGHT:
- animation_player.play_section_with_markers(animation_name, "Fifth", "Ninth")
- print("State: Delia Five Six Seven Eight")
- STATE.DELIA_WHOLE:
- animation_player.play_section_with_markers(animation_name, "First", "Ninth")
- print("State: Delia Wholes")
- print("There should be an animation here")
- await animation_player.animation_finished
- #turn the lilypads back on
- Global.lilypad_clickability.emit(false)
- Global.show_dialog.emit("Your turn!")
- #Advance the step
- step = step + 1
- func get_a_new_array():
- current_array.clear()
- match step:
- STATE.PLAYER_ONE:
- current_array += first_pitch_song_array
- print("State: Player One")
- STATE.PLAYER_TWO:
- current_array += second_pitch_song_array
- print("State: Player Two")
- STATE.PLAYER_ONE_TWO:
- current_array += first_pitch_song_array
- current_array += second_pitch_song_array
- print("State: Player One Two")
- STATE.PLAYER_THREE:
- current_array += third_pitch_song_array
- print("State: Player Three")
- STATE.PLAYER_FOUR:
- current_array += fourth_pitch_song_array
- print("State: Player Four")
- STATE.PLAYER_THREE_FOUR:
- current_array += third_pitch_song_array
- current_array += fourth_pitch_song_array
- print("State: Player Three Four")
- STATE.PLAYER_ONE_TWO_THREE_FOUR:
- current_array += first_pitch_song_array
- current_array += second_pitch_song_array
- current_array += third_pitch_song_array
- current_array += fourth_pitch_song_array
- print("State: Player One Two Three Four")
- STATE.PLAYER_FIVE:
- current_array += fifth_pitch_song_array
- print("State: Player Five")
- STATE.PLAYER_SIX:
- current_array += sixth_pitch_song_array
- print("State: Player Six")
- STATE.PLAYER_FIVE_SIX:
- current_array += fifth_pitch_song_array
- current_array += sixth_pitch_song_array
- print("State: Player Five Six")
- STATE.PLAYER_ONE_TWO_THREE_FOUR_FIVE_SIX:
- current_array += first_pitch_song_array
- current_array += second_pitch_song_array
- current_array += third_pitch_song_array
- current_array += fourth_pitch_song_array
- current_array += fifth_pitch_song_array
- current_array += sixth_pitch_song_array
- print("State: Player One Two Three Four Five Six")
- STATE.PLAYER_SEVEN:
- current_array += seventh_pitch_song_array
- print("State: Player Seven")
- STATE.PLAYER_EIGHT:
- current_array += eighth_pitch_song_array
- print("State: Player Eight")
- STATE.PLAYER_SEVEN_EIGHT:
- current_array += seventh_pitch_song_array
- current_array += eighth_pitch_song_array
- print("State: Player Seven Eight")
- STATE.PLAYER_FIVE_SIX_SEVEN_EIGHT:
- current_array += fifth_pitch_song_array
- current_array += sixth_pitch_song_array
- current_array += seventh_pitch_song_array
- current_array += eighth_pitch_song_array
- print("State: Player Five Six Seven Eight")
- STATE.PLAYER_WHOLE:
- current_array += first_pitch_song_array
- current_array += second_pitch_song_array
- current_array += third_pitch_song_array
- current_array += fourth_pitch_song_array
- current_array += fifth_pitch_song_array
- current_array += sixth_pitch_song_array
- current_array += seventh_pitch_song_array
- current_array += eighth_pitch_song_array
- print("Player Whole")
Advertisement
Add Comment
Please, Sign In to add comment