sfx and music

This commit is contained in:
D L 2023-01-29 18:39:59 -08:00
parent b9602abb51
commit 49b54b1aba
35 changed files with 719 additions and 11 deletions

View file

@ -3,7 +3,7 @@ extends Control
export var cutscene_name : String
export var next_scene_to_load : String
var text_speed : int = 24
var text_speed : int = 30
var text_label : RichTextLabel
var animation_player : AnimationPlayer
@ -20,11 +20,23 @@ var dialogue_fading_in : bool = true
var cutscene_directory = {
"Cutscene1": [
["Hello.",
"How are you?"],
["Kyouko: Woooow.",
"Kyouko: I can't believe it's taken this long for them to make a stupid game about me snowboarding."],
["I'm fine.",
"How about you?"],
["Reimu: Is the dialogue completed at least?",
"Kyouko: They're still working on it.",
"Reimu: Oh. Wake me up when they're finished."],
["Kyouko: Gee, I hope they get the game done soon.",
"Kyouko: I really wanna go snowboarding now."],
["Kyouko: Like I reaaally wanna. Really."],
],
"Cutscene2": [
["Kyouko: Ain't got nothing going on in Cutscene 2 huh."],
],
"Cutscene3": [
["Kyouko: Cutscene 3 too."],
],
}
@ -61,7 +73,7 @@ func final_fade_done():
func _process(delta):
this_text = cutscene_directory[cutscene_name][cutscene_index][cutscene_sub_index]
if Input.is_action_just_released("mouse_click"):
if Input.is_action_just_released("mouse_click") and not dialogue_fading_in:
if chars_rendered < this_text.length():
message_time_elapsed = 60
else:

View file

@ -55,6 +55,8 @@ var rng = RandomNumberGenerator.new()
# Called when the node enters the scene tree for the first time.
func _ready():
MusicController.play_kyouko_snow()
units.append(get_node("Player"))
player = units[0]
player.init_unit_w_scene(self)

View file

@ -13,6 +13,21 @@ var boost : float = 0 # to movement speed
var respawn_pos : Vector2
var hit_audiostream_player : AudioStreamPlayer
var spin_audiostream_player : AudioStreamPlayer
var jump_audiostream_player : AudioStreamPlayer
var land_audiostream_player : AudioStreamPlayer
var snow_audiostream_player : AudioStreamPlayer
func init_unit_w_scene(scene):
.init_unit_w_scene(scene)
hit_audiostream_player = scene.get_node("HitAudioStreamPlayer")
spin_audiostream_player = scene.get_node("SpinAudioStreamPlayer")
jump_audiostream_player = scene.get_node("JumpAudioStreamPlayer")
land_audiostream_player = scene.get_node("LandAudioStreamPlayer")
snow_audiostream_player = scene.get_node("SnowAudioStreamPlayer")
func execute_actions(delta):
.execute_actions(delta)
for action_num in Constants.UNIT_TYPE_ACTIONS[Constants.UnitType.PLAYER]:
@ -26,6 +41,8 @@ func execute_actions(delta):
pass
func spin(delta):
if (get_current_action() != Constants.UnitCurrentAction.SPINNING):
spin_audiostream_player.play()
set_current_action(Constants.UnitCurrentAction.SPINNING)
boost += boost_per_second * delta
current_sprite.visible = false
@ -49,6 +66,11 @@ func move():
elif last_contacted_map_elem_type == Constants.MapElemType.SLOPE_LEFT:
set_sprite(Constants.SpriteClass.WALK, 4)
func jump():
if get_current_action() != Constants.UnitCurrentAction.JUMPING:
jump_audiostream_player.play()
.jump()
func reset_current_action():
.reset_current_action()
if get_current_action() == Constants.UnitCurrentAction.SPINNING:
@ -58,6 +80,8 @@ func reset_current_action():
get_node("SpinningSprite").rotation = 0
.handle_idle()
current_sprite.visible = true
else:
spin_audiostream_player.stop()
func custom_inputs():
if scene.input_table[Constants.PlayerInput.GBA_B][scene.I_T_JUST_PRESSED]:
@ -154,6 +178,11 @@ func hit(dir : int):
set_action(Constants.ActionType.RECOIL)
set_current_action(Constants.UnitCurrentAction.RECOILING)
set_unit_condition(Constants.UnitCondition.MOVING_STATUS, Constants.UnitMovingStatus.IDLE)
get_node("SpinningSprite").visible = false
get_node("SpinningSprite").rotation = 0
hit_audiostream_player.play()
# override super class's RECOIL_PUSHBACK
func handle_recoil():
@ -166,9 +195,11 @@ func handle_recoil():
func landed():
get_node("SpinningSprite").visible = false
get_node("SpinningSprite").rotation = 0
land_audiostream_player.play()
if get_current_action() == Constants.UnitCurrentAction.SPINNING:
hit(Constants.Direction.RIGHT)
boost = 0
spin_audiostream_player.stop()
return
target_move_speed += boost
boost = 0
@ -206,6 +237,11 @@ func react(delta):
spectator_cam.make_current()
var anim_player : AnimationPlayer = scene.find_node("PitTransitionPlayer")
anim_player.play("PitTransition")
if get_condition(Constants.UnitCondition.IS_ON_GROUND, true) and h_speed > 3:
if not snow_audiostream_player.playing:
snow_audiostream_player.play()
else:
snow_audiostream_player.stop()
func respawn_from_pit():
pos = respawn_pos