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.

Small edit to footstep script

hi, i'm using this small script for creating footstep sounds:

#==============================================================================
# ** Hear_Steps
#------------------------------------------------------------------------------
#  by arevulopapo
#  9.11.2006
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  attr_accessor :hear_steps
  attr_accessor :step_sound
  #--------------------------------------------------------------------------
  alias hs_init initialize
  def initialize
    hs_init
    @hear_steps = true
    @step_sound = "Audio/SE/walk01"
  end
  alias hs_update update
  def update
    if self.moving? and self.hear_steps == true and (Graphics.frame_count + 2 * self.id) % (18 - @move_speed) == 0
      if self.screen_x > 0 and self.screen_x < 640 and self.screen_y > 0 and self.screen_y < 480
        volume = 50 - 5 * Math.sqrt((self.x - $game_player.x)**2 + (self.y - $game_player.y)**2)
        Audio.se_play(@step_sound, volume, 100)
      end
    end
    hs_update
  end
end

Problem is everything that moves on the map has footsteps now, including birds, rocks, light effects etc. So could someone edit this script so that only the character you're playing with has footsteps? Now, the script has only 29 lines, so i don't think it will involve a lot of work.

Thank a 'lot ;)
 

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