#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass for the
# Game_Player and Game_Event classes.
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Turn Down
#--------------------------------------------------------------------------
def turn_down
set_direction(2)
end
#--------------------------------------------------------------------------
# * Turn Left
#--------------------------------------------------------------------------
def turn_left
set_direction(4)
end
#--------------------------------------------------------------------------
# * Turn Right
#--------------------------------------------------------------------------
def turn_right
set_direction(6)
end
#--------------------------------------------------------------------------
# * Turn Up
#--------------------------------------------------------------------------
def turn_up
set_direction(8)
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left
# If no direction fix
unless @direction_fix
# Face down is facing right or up
set_direction(4) if @direction == reverse_dir(4)
set_direction(2) if @direction == reverse_dir(2)
end
# When a down to left or a left to down course is passable
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
(passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
# Update coordinates
@x -= 1
@y += 1
# Increase steps
increase_steps
end
end
#--------------------------------------------------------------------------
# * Move Lower Right
#--------------------------------------------------------------------------
def move_lower_right
# If no direction fix
unless @direction_fix
# Face right if facing left, and face down if facing up
set_direction(6) if @direction == reverse_dir(6)
set_direction(2) if @direction == reverse_dir(2)
end
# When a down to right or a right to down course is passable
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
(passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
# Update coordinates
@x += 1
@y += 1
# Increase steps
increase_steps
end
end
#--------------------------------------------------------------------------
# * Move Upper Left
#--------------------------------------------------------------------------
def move_upper_left
# If no direction fix
unless @direction_fix
# Face left if facing right, and face up if facing down
set_direction(4) if @direction == reverse_dir(4)
set_direction(8) if @direction == reverse_dir(8)
end
# When an up to left or a left to up course is passable
if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
(passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
# Update coordinates
@x -= 1
@y -= 1
# Increase steps
increase_steps
end
end
#--------------------------------------------------------------------------
# * Move Upper Right
#--------------------------------------------------------------------------
def move_upper_right
# If no direction fix
unless @direction_fix
# Face right if facing left, and face up if facing down
set_direction(6) if @direction == reverse_dir(6)
set_direction(8) if @direction == reverse_dir(8)
end
# When an up to right or a right to up course is passable
if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
(passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
# Update coordinates
@x += 1
@y -= 1
# Increase steps
increase_steps
end
end
#--------------------------------------------------------------------------
# * Set Direction
#--------------------------------------------------------------------------
def set_direction(d)
@direction = d if !@direction_fix && d != 0
@stop_count = 0
end
#--------------------------------------------------------------------------
# * Reverse Direction
#--------------------------------------------------------------------------
def reverse_dir(d)
return 10 - d
end
end
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# This class handles the player. Its functions include event starting
# determinants and map scrolling. Refer to "$game_player" for the one
# instance of this class.
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Set Direction
#--------------------------------------------------------------------------
alias __210927_aliased_set_direction set_direction
def set_direction(d)
__210927_aliased_set_direction(d) if ((d - 5).abs == 1)
end
end