물론 주인공이 달리면 걷는소리도 빨라진다.
지형에 따라서 건는 소리가 달라지기도 한다.
풀밭을 걷는소리 눈위를 걷는소리 등등 ^^
사용법
우선 아래 파일을 다운받아서 압축을 푼후 Audio/SE 폴더에 넣어주자
그런 다음 아래 스크립트를 main 섹선 위쪽에 붙여 넣어준다.
#==============================================================================
# ■ DeadlyDan_Footsteps by DeadlyDan
#------------------------------------------------------------------------------
# Enables ability to "sound" footsteps when walking over specific tiles
#==============================================================================
# Usage:
=begin
Simple, place the audio files in your SE directory, and try the game.
There are some known bugs in this, if anyone has any fixes just let me know:)
To add custom sounds for custom tiles you can do for example:
FOOTSTEP_WOOD = [15] # The tilenumber ID that you get with debug_tileid function
FOOTSTEP_WOOD_FILE = "Audio/SE/stepwood" # The filename for the sound
then add underneath the # Insert custom sounds here line:
footstep_check ( FOOTSTEP_WOOD, FOOTSTEP_WOOD_FILE, 0 )
The last number in that function stands for the layer, since the wood tile i
selected is on the ground layer, it's layer is 0.
(NOTE)
There is a problem that when you go on carpet it makes dirt and snow sounds,
i currently can't find a way to fix this, so, the best thing to do is to call
the command $game_player.footsteps_enabled = false.
To enable footsteps while stopping the carpet and tables from making the snow
and dirt sounds, there's an uneasy solution of placing a touch event which
calls $game_player.footsteps_enabled = false.
Sorry about this inconvenience.
=end
class Game_Player < Game_Character
FOOTSTEP_GRASS = [28, 29, 30]
FOOTSTEP_GRASS_LONG = [29, 30]
FOOTSTEP_GRASS_FILE = "Audio/SE/stepgrass"
FOOTSTEP_DIRT = [32, 33, 34]
FOOTSTEP_DIRT_LONG = [32 ,34]
FOOTSTEP_DIRT_FILE = "Audio/SE/stepdirt"
FOOTSTEP_SAND = [36, 37, 38]
FOOTSTEP_SAND_LONG = [36, 38]
FOOTSTEP_SAND_FILE = "Audio/SE/stepdirt"
FOOTSTEP_SNOW = [39, 41]
FOOTSTEP_SNOW_LONG = [40, 41]
FOOTSTEP_SNOW_FILE = "Audio/SE/stepsnow"
FOOTSTEP_WOOD = [15]
FOOTSTEP_WOOD_FILE = "Audio/SE/stepwood"
FOOTSTEP_PITCH = 100
FOOTSTEP_PITCH2 = 90
attr_accessor :last_foot
attr_accessor :footsteps_enabled
alias foot_initialize initialize
def initialize
foot_initialize
@last_foot = 0
@last_foot_pitch = FOOTSTEP_PITCH2
@next_foot_pitch = FOOTSTEP_PITCH
@footsteps_enabled = true
end
alias foot_move_left move_left
def move_left ( turn_ok = true )
foot_move_left ( turn_ok )
if ( @move_failed == false )
sound_foot
end
end
alias foot_move_right move_right
def move_right ( turn_ok = true )
foot_move_right ( turn_ok )
if ( @move_failed == false )
sound_foot
end
end
alias foot_move_up move_up
def move_up ( turn_ok = true )
foot_move_up ( turn_ok )
if ( @move_failed == false and @footsteps_enabled )
sound_foot
end
end
alias foot_move_down move_down
def move_down ( turn_ok = true )
foot_move_down ( turn_ok )
if ( @move_failed == false and @footsteps_enabled )
sound_foot
end
end
def no_layer_tile? ( layer )
result = [false, false, false]
for i in 0..2
if ( @map_tile_id[i] == 0 )
result[i] = true
end
end
if ( layer == 0 )
if ( result[1] and result[2] )
return true
else
return false
end
end
else if ( layer == 1 )
if ( result[2] )
return true
else
return false
end
else
return true
end
end
def debug_tileid
$game_message.texts[0] = @map_tile_tex[0]
$game_message.texts[1] = @map_tile_tex[1]
$game_message.texts[2] = @map_tile_tex[2]
end
def footstep_check ( footstep, file, layer )
for i in 0..footstep.length
if ( ( @map_tile_tex[layer] == footstep[i].to_s ) and ( no_layer_tile? ( layer ) ) )
Audio.se_play ( file, 100, @next_foot_pitch )
@last_foot = Graphics.frame_count
return nil
end
end
end
def sound_foot
if ( dash? )
mul = 6
else
mul = 7
end
if ( Graphics.frame_count > ( @last_foot + mul ) )
@map_tile_id = []
@map_tile_tex = []
for i in 0..2
@map_tile_id.push ( $game_map.data[@x, @y, i] )
@map_tile_tex.push ( @map_tile_id[i].to_s[0,2] )
end
# Use "debug_tileid" here to bring up the numbers of all the current tiles
# to use with definitions of the tileids, walk over tiles ingame...
if ( @last_foot_pitch == FOOTSTEP_PITCH )
@next_foot_pitch = FOOTSTEP_PITCH2
@last_foot_pitch = FOOTSTEP_PITCH2
else
@next_foot_pitch = FOOTSTEP_PITCH
@last_foot_pitch = FOOTSTEP_PITCH
end
# Ground layer
footstep_check ( FOOTSTEP_GRASS, FOOTSTEP_GRASS_FILE, 0 )
footstep_check ( FOOTSTEP_DIRT, FOOTSTEP_DIRT_FILE, 0 )
footstep_check ( FOOTSTEP_SAND, FOOTSTEP_SAND_FILE, 0 )
footstep_check ( FOOTSTEP_SNOW, FOOTSTEP_SNOW_FILE, 0 )
footstep_check ( FOOTSTEP_WOOD, FOOTSTEP_WOOD_FILE, 0 )
# Layer 1
footstep_check ( FOOTSTEP_GRASS_LONG, FOOTSTEP_GRASS_FILE, 1 )
footstep_check ( FOOTSTEP_DIRT_LONG, FOOTSTEP_DIRT_FILE, 1 )
footstep_check ( FOOTSTEP_SAND_LONG, FOOTSTEP_SAND_FILE, 1 )
footstep_check ( FOOTSTEP_SNOW_LONG, FOOTSTEP_SNOW_FILE, 1 )
# Insert custom sounds here
end
end
end
'게임이야기. > RPG 만들기 VX' 카테고리의 다른 글
RPG 만들기 VX 전투중 메시지 속도 조절 (0) | 2008.02.01 |
---|---|
RPG 만들기 VX (설치버전 10) (2) | 2008.01.31 |
점프를 제한 하는 스크립트 (0) | 2008.01.31 |
VX에서 포그 그래픽을 사용하자 (0) | 2008.01.31 |
최고레벨 제한하기 (0) | 2008.01.30 |
윈도우 크기 조절 스크립트 0.3 (0) | 2008.01.30 |
게임 시스템의 제작 (3) | 2008.01.30 |