#==============================================================================
# Lemony's 先转头后移动, (LSERTM), (ReStaff Febraury 2013), v.1.0
#==============================================================================
# 可以让玩家在按下方向键后先转头后,然后再移动.
#==============================================================================
# (*) 使用方法.-
#==============================================================================
# * 设定下面的 LSERTM_KeyBind 来设定转头键 (详情参考rgss3中的符号列表)
# * 设定下面的 LSERTM_Switch 来设定开关,开启或关闭本脚本的功能.
# * 设定下面的 LSERTM_WalkDelay 来设定按下方向键后等待时间,时间过去后玩家才会
# 行走.
#==============================================================================
# (**) Terms of Use.-
#==============================================================================
# This script is free to use in any commercial or non commercial game or
# project created with any RPG Maker with a valid license as long as explicit
# credits are given to the author (Lemony).
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# 转头键 [OPT]
#--------------------------------------------------------------------------
LSERTM_KeyBind = nil
#--------------------------------------------------------------------------
# 开关 ID [OPT]
#--------------------------------------------------------------------------
LSERTM_Switch = 0
#--------------------------------------------------------------------------
# 按下方向键后等待时间 [OPT]
#--------------------------------------------------------------------------
LSERTM_WalkDelay = 10
#--------------------------------------------------------------------------
# Alias Move by Input. [MOD]
#--------------------------------------------------------------------------
alias lsertm_move_by_input move_by_input
def move_by_input
if !$game_switches[LSERTM_Switch] && (LSERTM_KeyBind.nil? ? true :
Input.press?(LSERTM_KeyBind))
return if (!movable? || $game_map.interpreter.running?)
@sle_rbm ||= [0, 0]
keym = {2 => :DOWN, 4 => :LEFT, 6 => :RIGHT, 8 => :UP}[Input.dir4]
if Input.dir4 > 0 && Input.trigger?(keym)
@sle_rbm, @direction = [Input.dir4, LSERTM_WalkDelay], Input.dir4
end
if @sle_rbm[1] > 0 && !Input.press?(:SHIFT)
@sle_rbm[1] = [@sle_rbm[1] - 1, 0].max
if @sle_rbm[1] == 0
move_straight(@sle_rbm[0]) if (@sle_rbm[0] == Input.dir4)
@sle_rbm = [0, 0]
end
else
move_straight(Input.dir4)
end
else
lsertm_move_by_input
end
end
end