#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/ ? Adjustable Speed & 8-Way Directional Movement - KGC_Dash_8DirMove ? VX ?
#_/ ? Last Update: 2008/05/29 ?
#_/ ? Translation and Updates by by Mr. Anonymous ?
#_/-----------------------------------------------------------------------------
#_/ This script adds 8-way-directional movement and speed adjustment settings.
#_/ Note: Still need to finish documentation concerning 8DIR_ANIMATION
#_/=============================================================================
#_/ Install: Insert below KGC_TilesetExtension.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#==============================================================================#
# ? Customization ? #
#==============================================================================#
module KGC
module Dash_8DirMove
# ? 8-Way Directional Movement ?
# true = Enables the character to move in diagonal directions.
# false = Disable diagonal movement, restricting the player to the default
# movement system of up, down, left, and right.
ENABLE_8DIR = true
# ? 8-Way Directional Animation ?
# I believe this toggle is to allow the system to use 8-way directional
# animations for charactersets who have the additional cells to do so.
# By default an image with the additional frames should be suffixed with a #
ENABLE_8DIR_ANIMATION = false
# ? Walk Speed ?
# Allows you to change the default rate of speed the actor walks.
# A DEFAULT_WALK_SPEED of 4 is the default RMVX walk speed.
DEFAULT_WALK_SPEED = 4
# ? Dash Speed ?
# Allows you to change the default rate of speed the actor dashes.
# A DASH_SPEED_RATE of 3 is the default RMVX dash speed.
DASH_SPEED_RATE = 3
end
end
#------------------------------------------------------------------------------#
$imported = {} if $imported == nil
$imported["Dash_8DirMove"] = true
module KGC::Dash_8DirMove
# Image Suffix
SLANT_SUFFIX = "#"
end
#==============================================================================
# ? KGC::Commands
#==============================================================================
module KGC::Commands
module_function
#--------------------------------------------------------------------------
# ? Reset Walk Speed
#--------------------------------------------------------------------------
def reset_walk_speed
$game_player.reset_move_speed
end
#--------------------------------------------------------------------------
# ? Set Walk Speed
#--------------------------------------------------------------------------
def set_walk_speed(value)
$game_system.temp_walk_speed = value
end
#--------------------------------------------------------------------------
# ? Set Dash Speed
#--------------------------------------------------------------------------
def set_dash_speed(value)
$game_system.temp_dash_speed = value
end
end
class Game_Interpreter
include KGC::Commands
end
#==============================================================================
# ? Game_System
# * Added by Mr. Anonymous 5/29/08
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ? Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :temp_dash_speed # Temporary Dash Speed
attr_accessor :temp_walk_speed # Temporary Walk Speed
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
alias initialize_KGC_Dash_8DirMove initialize
def initialize
initialize_KGC_Dash_8DirMove
@temp_dash_speed = nil
@temp_walk_speed = nil
end
end
#==============================================================================
# ? Game_Party
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ? Decrease Steps
#--------------------------------------------------------------------------
def decrease_steps
@steps -= 1
end
end
#==============================================================================
# ? Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# ? Direction (?-Way Movement)
#--------------------------------------------------------------------------
def direction_8dir
return @direction
end
#--------------------------------------------------------------------------
# ? Set Direction
# direction : Directions
#--------------------------------------------------------------------------
alias set_direction_KGC_Dash_8DirMove set_direction
def set_direction(direction)
last_dir = @direction
set_direction_KGC_Dash_8DirMove(direction)
if !@direction_fix && direction != 0
@direction_8dir = direction
end
end
#--------------------------------------------------------------------------
# ?
??
#--------------------------------------------------------------------------
alias move_lower_left_KGC_Dash_8DirMove move_lower_left
def move_lower_left
move_lower_left_KGC_Dash_8DirMove
@direction_8dir = 1 unless @direction_fix
end
#--------------------------------------------------------------------------
# ?
??
#--------------------------------------------------------------------------
alias move_lower_right_KGC_Dash_8DirMove move_lower_right
def move_lower_right
move_lower_right_KGC_Dash_8DirMove
@direction_8dir = 3 unless @direction_fix
end
#--------------------------------------------------------------------------
# ?
??
#--------------------------------------------------------------------------
alias move_upper_left_KGC_Dash_8DirMove move_upper_left
def move_upper_left
move_upper_left_KGC_Dash_8DirMove
@direction_8dir = 7 unless @direction_fix
end
#--------------------------------------------------------------------------
# ?
??
#--------------------------------------------------------------------------
alias move_upper_right_KGC_Dash_8DirMove move_upper_right
def move_upper_right
move_upper_right_KGC_Dash_8DirMove
@direction_8dir = 9 unless @direction_fix
end
end
#==============================================================================
# ? Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ?
#--------------------------------------------------------------------------
alias initialize_KGC_Dash_8DirMove initialize
def initialize
initialize_KGC_Dash_8DirMove
reset_move_speed
end
#--------------------------------------------------------------------------
# ? ?? (
?)
#--------------------------------------------------------------------------
def direction_8dir
@direction_8dir = @direction if @direction_8dir == nil
return @direction_8dir
end
#--------------------------------------------------------------------------
# ?
#--------------------------------------------------------------------------
def reset_move_speed
@move_speed = KGC::Dash_8DirMove::DEFAULT_WALK_SPEED
$game_system.temp_dash_speed = nil
$game_system.temp_walk_speed = nil
end
if KGC::Dash_8DirMove::ENABLE_8DIR
#--------------------------------------------------------------------------
# ?
??
#--------------------------------------------------------------------------
def move_by_input
return unless movable?
return if $game_map.interpreter.running?
last_steps = $game_party.steps
case Input.dir8
when 1; move_down; move_left; @direction = 2
when 2; move_down
when 3; move_down; move_right; @direction = 6
when 4; move_left
when 6; move_right
when 7; move_up; move_left; @direction = 4
when 8; move_up
when 9; move_up; move_right; @direction = 8
else; return
end
@direction_8dir = Input.dir8
#
if $game_party.steps - last_steps == 2
$game_party.decrease_steps
end
end
end # ENABLE_8DIR
#--------------------------------------------------------------------------
# ? Upate Movement
#--------------------------------------------------------------------------
def update_move
distance = 2 ** @move_speed #
?
if dash? #
distance *= KGC::Dash_8DirMove::DASH_SPEED_RATE
#--------------------------------------------------------------------
# ? Process Temp Walk/Dash Speed
# * Added by Mr. Anonymous 5/29/08
#--------------------------------------------------------------------
if $game_system.temp_dash_speed == nil
@move_speed = KGC::Dash_8DirMove::DASH_SPEED_RATE
else
@move_speed = $game_system.temp_dash_speed
end
else
if $game_system.temp_walk_speed == nil
@move_speed = KGC::Dash_8DirMove::DEFAULT_WALK_SPEED
else
@move_speed = $game_system.temp_walk_speed
# Automatically adjust move frequency to move speed.
=begin
if $game_system.temp_walk_speed <= 4
@move_frequency = 6
elsif $game_system.temp_walk_speed == 3
@move_frequency = 5
elsif $game_system.temp_walk_speed == 2
@move_frequency = 3
elsif $game_system.temp_walk_speed == 1
@move_frequency = 3
end
=end
end
#--- End 5/29/08 Update
end
distance = Integer(distance)
@real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
@real_x = [@real_x + distance, @x * 256].min if @x * 256 > @real_x
@real_y = [@real_y - distance, @y * 256].max if @y * 256 < @real_y
@real_y = [@real_y + distance, @y * 256].min if @y * 256 > @real_y
update_bush_depth unless moving?
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
end
end
#==============================================================================
# ? Sprite_Character
#==============================================================================
if KGC::Dash_8DirMove::ENABLE_8DIR_ANIMATION
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
SLANT_ANIME_TABLE = { 1=>2, 3=>6, 7=>4, 9=>8 }
#--------------------------------------------------------------------------
# ?
#--------------------------------------------------------------------------
alias update_bitmap_KGC_Dash_8DirMove update_bitmap
def update_bitmap
name_changed = (@character_name != @character.character_name)
update_bitmap_KGC_Dash_8DirMove
if @tile_id > 0 #
?
@enable_slant = false
return
end
return unless name_changed #
?
#
??
@enable_slant = true
begin
@character_name_slant = @character_name + KGC::Dash_8DirMove::SLANT_SUFFIX
Cache.character(@character_name_slant)
rescue
@enable_slant = false
end
end
#--------------------------------------------------------------------------
# ?
??
#--------------------------------------------------------------------------
alias update_src_rect_KGC_Dash_8DirMove update_src_rect
def update_src_rect
return if @tile_id > 0 #
??
if @enable_slant
update_src_rect_for_slant
else
update_src_rect_KGC_Dash_8DirMove
end
end
#--------------------------------------------------------------------------
# ?
?
#--------------------------------------------------------------------------
def update_src_rect_for_slant
index = @character.character_index
pattern = @character.pattern < 3 ? @character.pattern : 1
sx = (index % 4 * 3 + pattern) * @cw
dir = @character.direction_8dir
case dir % 2
when 0 #
?
if @last_slant
self.bitmap = Cache.character(@character_name)
@last_slant = false
end
else # ??
unless @last_slant
self.bitmap = Cache.character(@character_name_slant)
@last_slant = true
end
# Convert 1, 3, 7, 9 ? 2, 6, 4, 8
dir = SLANT_ANIME_TABLE[dir]
end
sy = (index / 4 * 4 + (dir - 2) / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
end # ENABLE_8DIR_ANIMATION
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/ The original untranslated version of this script can be found here:
#
http://f44.aaa.livedoor.jp/~ytomy/tkool/rpgtech/php/tech.php?tool=VX&cat=tech_vx/map&tech=dash_8dir_move#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_