From 62418329d4ac1152a4ea2bc411d77db0431c1882 Mon Sep 17 00:00:00 2001 From: Mathew Velasquez Date: Fri, 11 Mar 2016 02:29:08 -0500 Subject: [PATCH] Tweaks for footsteps and timer --- scripts/Data_Footsteps.rb | 6 +++--- scripts/Game_Player.rb | 11 ++++++++++- scripts/Window_Message.rb | 8 +++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/scripts/Data_Footsteps.rb b/scripts/Data_Footsteps.rb index ecb3704..69af2c0 100644 --- a/scripts/Data_Footsteps.rb +++ b/scripts/Data_Footsteps.rb @@ -1,7 +1,6 @@ FOOTSTEP_SFX = [ # Start - ['step_wood', - 'step_carpet'], + ['step_wood'], # Blue ['step_gravel', 'step_wood'], @@ -41,5 +40,6 @@ FOOTSTEP_SFX = [ ] FOOTSTEP_AMT = { - 'step_metal' => 4 + 'step_metal' => 4, + 'step_tile' => 4, } diff --git a/scripts/Game_Player.rb b/scripts/Game_Player.rb index 8879725..7381b23 100644 --- a/scripts/Game_Player.rb +++ b/scripts/Game_Player.rb @@ -63,7 +63,6 @@ class Game_Player < Game_Character #-------------------------------------------------------------------------- def increase_steps super - emit_footstep # If move route is not forcing unless @move_route_forcing # Increase steps @@ -219,6 +218,16 @@ class Game_Player < Game_Character last_real_x = @real_x last_real_y = @real_y super + # Emit footsteps + if moving? || last_real_x != @real_x || last_real_y != @real_y + @footstep_timer += 1 + if (@move_speed <= 3 && @footstep_timer >= 16) || (@move_speed >= 4 && @footstep_timer >= 12) + emit_footstep + @footstep_timer = 0 + end + else + @footstep_timer = 8 + end # If character moves down and is positioned lower than the center # of the screen if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y diff --git a/scripts/Window_Message.rb b/scripts/Window_Message.rb index cef1e2e..a419347 100644 --- a/scripts/Window_Message.rb +++ b/scripts/Window_Message.rb @@ -36,6 +36,9 @@ class Window_Message < Window_Selectable @number_start = -1 # skip message proc if we have choices/numbers buffered @skip_message_proc = false + + # Text blip sound + @blipsound = nil end #-------------------------------------------------------------------------- # * Dispose @@ -90,6 +93,9 @@ class Window_Message < Window_Selectable if $game_temp.message_text != nil && !$game_temp.message_text.empty? text = $game_temp.message_text + # Determine blip sound + @blipsound = text.start_with?('[') ? 'text_robot' : 'text' + # Substitute variables, actors, player name, newlines, etc text.gsub!(/\\v\[([0-9]+)\]/) do $game_variables[$1.to_i] @@ -322,7 +328,7 @@ class Window_Message < Window_Selectable @text_pause -= 1 else if @blip >= BLIP_TIME - Audio.se_play('Audio/SE/text.wav') unless @text.empty? + Audio.se_play("Audio/SE/#{@blipsound}.wav", 50) unless @text.empty? @blip = 0 else @blip += 1