#==============================================================================
# ★ 正太君的鬼怪脚本
#------------------------------------------------------------------------------
# 本脚本来自[url]www.66rpg.com[/url]
# 作者:正太君
#------------------------------------------------------------------------------
# 使用请保留版权信息,谢谢...
#==============================================================================
class Game_Player < Game_Character
attr_reader :player_position
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
last_real_x = @real_x
last_real_y = @real_y
last_moving = moving?
move_by_input
super
update_scroll(last_real_x, last_real_y)
update_vehicle
update_nonmoving(last_moving)
save_position
end
#--------------------------------------------------------------------------
# ● 保存角色上一步的位置
#--------------------------------------------------------------------------
def save_position
@player_position = [[@x, @y],[@x, @y]] if @player_position.nil?
@player_position.push([@x, @y]) if @player_position[1] != [@x, @y]
@player_position.shift if @player_position.size > 2
end
end
class Game_Character
#--------------------------------------------------------------------------
# ● 跟随角色
#--------------------------------------------------------------------------
def follow_player
return if $game_player.player_position.nil?
event_position_x = $game_player.player_position[0][0]
event_position_y = $game_player.player_position[0][1]
player_position_x = $game_player.x
player_position_y = $game_player.y
if @x > event_position_x
move_left
elsif @x < event_position_x
move_right
elsif @y > event_position_y
move_up
elsif @y < event_position_y
move_down
end
end
end
#==============================================================================
# 本脚本来自[url]www.66rpg.com[/url]
# 作者:正太君
#------------------------------------------------------------------------------
# 使用请保留版权信息,谢谢...
#==============================================================================