end
end
class Game_Event
include Train_Actor::Game_Event_Module
end
# Game_Party_Actor.rb
#==============================================================================
# ■ Game_Party_Actor
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
module Train_Actor
class Game_Party_Actor < Game_Player
attr_writer :move_speed
attr_writer :step_anime
def initialize
super()
@through = true
end
def setup(actor)
# The file name and hue of the character are set
if actor != nil and (not actor.dead?) # When dead, it is erased for the time being...
@character_name = actor.character_name
@character_hue = actor.character_hue
else
@character_name = ""
@character_hue = 0
end
# Opacity and blending method are initialized
@opacity = 255
@blend_type = 0
end
def screen_z(height = 0)
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z(height) - 1
end
super(height)
end
#--------------------------------------------------------------------------
# ● Move down
# turn_enabled : Flag that permits direction change on the spot
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
# Face down
if turn_enabled
turn_down
end
# When possible to pass
if passable?(@x, @y, Input::DOWN)
# Face down
turn_down
# Update coordinates
@y += 1
end
end
#--------------------------------------------------------------------------
# ● Move left
# turn_enabled : Flag that permits direction change on the spot
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
# Face left
if turn_enabled
turn_left
end
# When possible to pass
if passable?(@x, @y, Input::LEFT)
# Face left
turn_left
# Update coordinates
@x -= 1
end
end
#--------------------------------------------------------------------------
# ● Move right
# turn_enabled : Flag that permits direction change on the spot
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
# Face right
if turn_enabled
turn_right
end
# When possible to pass
if passable?(@x, @y, Input::RIGHT)
# Face right
turn_right
# Update coordinates
@x += 1
end
end
#--------------------------------------------------------------------------
# ● Move up
# turn_enabled : Flag that permits direction change on the spot
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
# Face up
if turn_enabled
turn_up
end
# When possible to pass
if passable?(@x, @y, Input::UP)
# Face up
turn_up
# Update coordinates
@y -= 1
end
end
#--------------------------------------------------------------------------
# ● Move lower left
#--------------------------------------------------------------------------
def move_lower_left
# When no direction fixation
unless @direction_fix
# Turn left when facing right, turn down when facing up
@direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
end
# When possible to move from down→left or from left→down
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
# Update coordinates
@x -= 1
@y += 1
end
end
#--------------------------------------------------------------------------
# ● Move lower right
#--------------------------------------------------------------------------
def move_lower_right
# When no direction fixation
unless @direction_fix
# Turn right when facing left, turn down when facing up
@direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
end
# When possible to move from down→right or from right→down
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
# Update coordinates
@x += 1
@y += 1
end
end
#--------------------------------------------------------------------------
# ● move upper left
#--------------------------------------------------------------------------
def move_upper_left
# When no direction fixation
unless @direction_fix
# Turn left when facing right, turn up when facing down
@direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
end
# When possible to move from up→left or from left→up
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
# Update coordinates
@x -= 1
@y -= 1
end
end
#--------------------------------------------------------------------------
# ● move upper right
#--------------------------------------------------------------------------
def move_upper_right
# When no direction fixation
unless @direction_fix
# Turn right when facing left, turn up when facing down
@direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
end
# When possible to move from up→right or from right→up
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
# Update coordinates
@x += 1
@y -= 1
end
end
end
end