#----------------------------------------------------------------------------
# Modified Angle Movement
#
# This script allows you to apply a factor to forced angle moves to adjust the
# amount in X or Y a character moves with a "Move Lower Right" type of move.
# (intended for use with stairs & ramps)
#
# Set XVAR & YVAR to 2 variables that you will use to signify the factors.
# The default value for either factor is 1.
# For example, if you want to move 2 tiles in X for every 1 tile in Y, set
# the game variable[10] to '2'
#
# For custom moves, use the following event commands:
# (To move Up 1 tile, and Left 2 tiles)
#-------------------------------------------
# @>Control Variables: [0011: Y Factor] = 2
# @>Set Move Route: This Event
# : :$>Move Upper Left
# @>Wait for Move's Completion
# @>Control Variables: [0011: Y Factor] = 1
#-------------------------------------------
# You can also reset the variable to 0, it will correct to 1.
#
# ALWAYS reset the variables to 0 or 1 after your angled move.
# or the rest of your events & player will behave eratically.
# ALWAYS use a "Wait for Move's Completion", or the event's movement
# will not be smooth
#
# You may also want to adjust the speed in the Move Route command,
# since you will be moving ~twice the distance in the same time.
#
# Requested By: Seita
# Created By: Brewmeister 16APR08
#
#----------------------------------------------------------------------------
class Game_Character
XVAR = 10
YVAR = 11
#--------------------------------------------------------------------------
# * Update frame (move)
#--------------------------------------------------------------------------
def update_move
# Convert map coordinates from map move speed into move distance
distance = 2 ** @move_speed
x_factor = ($game_variables[XVAR] == 0 ? 1 : $game_variables[XVAR])
y_factor = ($game_variables[YVAR] == 0 ? 1 : $game_variables[YVAR])
# If logical coordinates are further down than real coordinates
if @y * 128 > @real_y
# Move down
@real_y = [@real_y + distance * y_factor, @y * 128].min
end
# If logical coordinates are more to the left than real coordinates
if @x * 128 < @real_x
# Move left
@real_x = [@real_x - distance * x_factor, @x * 128].max
end
# If logical coordinates are more to the right than real coordinates
if @x * 128 > @real_x
# Move right
@real_x = [@real_x + distance * x_factor, @x * 128].min
end
# If logical coordinates are further up than real coordinates
if @y * 128 < @real_y
# Move up
@real_y = [@real_y - distance * y_factor, @y * 128].max
end
# If move animation is ON
if @walk_anime
# Increase animation count by 1.5
@anime_count += 1.5
# If move animation is OFF, and stop animation is ON
elsif @step_anime
# Increase animation count by 1
@anime_count += 1
end
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left
# If no direction fix
unless @direction_fix
# Face down is facing right or up
@direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
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 -= ($game_variables[XVAR] == 0 ? 1 : $game_variables[XVAR])
@y += ($game_variables[YVAR] == 0 ? 1 : $game_variables[YVAR])
# 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
@direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
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 += ($game_variables[XVAR] == 0 ? 1 : $game_variables[XVAR])
@y += ($game_variables[YVAR] == 0 ? 1 : $game_variables[YVAR])
# 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
@direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
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 -= ($game_variables[XVAR] == 0 ? 1 : $game_variables[XVAR])
@y -= ($game_variables[YVAR] == 0 ? 1 : $game_variables[YVAR])
# 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
@direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
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 += ($game_variables[XVAR] == 0 ? 1 : $game_variables[XVAR])
@y -= ($game_variables[YVAR] == 0 ? 1 : $game_variables[YVAR])
# Increase steps
increase_steps
end
end
end