sfx and music
This commit is contained in:
parent
b9602abb51
commit
49b54b1aba
35 changed files with 719 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue