Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Walking Sound (NEED WAIT TIME) [SOLVED]

Alright, I have tried and tried, but I can't figure out how to do this. I need a wait time between each time the sound effect plays when the player walks because when I do it like this, the sound effect sounds like a machine gun. >< I need a custom wait in between each sound effect playing because the sound effect allows for 2 steps per sound to make it look like the steps are aligned with the sounds. Could someone please help me here?

Walking Script
Code:
#---------------------------------------------------------------------------

# Walking Sounds

# By Racheal

# Edited by Joshua Long

#---------------------------------------------------------------------------

  SOUNDS = []

  SOUNDS[1] = RPG::AudioFile.new("Step_Cement", 80, 100)

  SOUNDS[4] = RPG::AudioFile.new("032-Switch01", 60, 150)

  alias old_update update

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    last_moving = moving?

    old_update

    if !moving? and last_moving

      terrain = $game_map.terrain_tag(x, y)

      if SOUNDS[terrain] != nil

        $game_system.se_play(SOUNDS[terrain])

      end

    end

  end

end
 
Post your Step_Cement sound. I assume it's a longer sound sample, but no way to time it without a longer sound.

I just tried it with the 'Knock" sounds, and it seems to work fine. (the Switch sound ain't so good.)
 
So you just want a wait a command to put in there?
try this:

Alright, I have tried and tried, but I can't figure out how to do this. I need a wait time between each time the sound effect plays when the player walks because when I do it like this, the sound effect sounds like a machine gun. >< I need a custom wait in between each sound effect playing because the sound effect allows for 2 steps per sound to make it look like the steps are aligned with the sounds. Could someone please help me here?

Code:
Walking Script

Line number On/Off | Expand/Contract | Select all

#---------------------------------------------------------------------------

# Walking Sounds

# By Racheal

# Edited by Joshua Long

#---------------------------------------------------------------------------

  SOUNDS = []

  SOUNDS[1] = RPG::AudioFile.new("Step_Cement", 80, 100)

  SOUNDS[4] = RPG::AudioFile.new("032-Switch01", 60, 150)

  alias mouravision_old_initialize initialize

 

  def initialize(*args)

     mouravision_old_initialize(args)

     @wait = 0

     @wait_r = 10

  end

  alias old_update update

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    last_moving = moving?

    old_update

    if !moving? and last_moving

      terrain = $game_map.terrain_tag(x, y)

      if ( @wait > 0 )

          @wait -= 1

          return

      end

      @wait = @wait_r

      if SOUNDS[terrain] != nil

        $game_system.se_play(SOUNDS[terrain])

      end

    end

  end

end

There you have it, just mess with @wait_r to give it the right timing.

Be Well.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top