class Game_Player
def do_new_direction
if Input.press?(:X)
if Input.trigger?(:UP)
set_direction(8)
elsif Input.trigger?(:DOWN)
set_direction(2)
elsif Input.trigger?(:LEFT)
set_direction(4)
elsif Input.trigger?(:RIGHT)
set_direction(6)
end
end
end
alias mfxrbmbi190316 move_by_input
def move_by_input
return if Input.press?(:X)
mfxrbmbi190316
end
alias mfxrbupdate190627 update
def update
do_new_direction
mfxrbupdate190627
update_play_command
end
def has_follower?(index,x,y)
@followers[index].x == x && @followers[index].y == y
end
def follower_ahead?
e_x = $game_player.x + 1
e_x2 = $game_player.x - 1
e_y = $game_player.y + 1
e_y2 = $game_player.y - 1
a = has_follower?(0,e_x,$game_player.y)
b = has_follower?(0,e_x2,$game_player.y)
c = has_follower?(0,$game_player.x,e_y)
d = has_follower?(0,$game_player.x,e_y2)
if (a && $game_player.direction == 6) or (b && $game_player.direction == 4) or(c && $game_player.direction == 2) or (d && $game_player.direction == 8)
return true
else
return false
end
end
def update_play_command
return unless follower_ahead?
if Input.trigger?(:C) && $game_variables[1].is_a?(Integer)
$game_temp.reserve_common_event($game_variables[1])
end
end
end