RPGnewbieOO7
Member
I'm having trouble making the character that follows you change graphic when I run. I'm using common events to run and am not sure how to change the follower. Please help.
Edit: If it helps here's the script I used.
Edit: If it helps here's the script I used.
# rgss-lib
=begin
‚c‚pƒVƒXƒeƒ€ƒXƒNƒŠƒvƒg Train_Actor
Author:: yf30 at users.sourceforge.jp (http://sourceforge.jp/users/yf30/)
Date:: 2009/02/26
Copyright:: Copyright (C) 2004-2009 rgss-lib
URL:: http://sourceforge.jp/projects/rgss-lib/
=end
# dq
# train_actor
# Config.rb
#==============================================================================
# ¡ Train_Actor::Config
#------------------------------------------------------------------------------
# ƒ}ƒbƒvã‚ŃAƒNƒ^[‚ð‘à—ñˆÚ“®‚³‚¹‚é
#==============================================================================
module Train_Actor
# œ“§–¾ó‘Ô—pƒXƒCƒbƒ`Ý’è
# true ‚¾‚ƃXƒCƒbƒ`§Œä‚ðs‚¤
#TRANSPARENT_SWITCH = true
TRANSPARENT_SWITCH = false
# œ“§–¾ó‘Ô—pƒXƒCƒbƒ`”Ô†
# TRANSPARENT_SWITCH ‚ª true ‚ÅA‚±‚̔Ԇ‚̃XƒCƒbƒ`‚ªON‚¾‚Æ“§–¾‚É‚È‚é
TRANSPARENT_SWITCHES_INDEX = 20
# œƒAƒNƒ^[‚ÌÅ‘å”
# «—ˆ“I‚É‘½l”ƒp[ƒeƒB‚ªo—ˆ‚é‚悤‚É‚È‚Á‚½‚çc
TRAIN_ACTOR_SIZE_MAX = 4
# Ž€–SŽž‚̃Lƒƒƒ‰ƒNƒ^[ƒOƒ‰ƒtƒBƒbƒN–¼
#DEAD_CHARACTER_NAME = "Coffin"
DEAD_CHARACTER_NAME = ""
# ’è”
DOWN_LEFT = 1
DOWN_RIGHT = 3
UP_LEFT = 7
UP_RIGHT = 9
JUMP = 5
STOP = 0
end
# rgss
# Game_Event_Module.rb
# Game_Event_Module
# ƒ}ƒbƒvã‚ŃAƒNƒ^[‚ð‘à—ñˆÚ“®‚³‚¹‚é
# Author:: fukuyama
# Date:: 2006/03/05
# Copyright:: Copyright (C) 2005 fukuyama
module Train_Actor
module Game_Event_Module
# ’Ês‰Â”\”»’è
# x:: X À•W
# y:: Y À•W
# d:: •ûŒü (0,2,4,6,8) ¦ 0 = ‘S•ûŒü’Ês•s‰Â‚Ìꇂ𔻒è (ƒWƒƒƒ“ƒv—p)
# return:: ’Ês•s‰Â false ‰Â”\ true
def passable?(x, y, d)
result = super(x, y, d)
return result if @through
if result
# V‚µ‚¢À•W‚ð‹‚ß‚é
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
# ƒgƒŒƒCƒ“ƒAƒNƒ^[‚̃‹[ƒv
for actor in $game_party.characters
# •\Ž¦‚³‚ê‚Ä‚¢‚éê‡
if (not actor.character_name.empty?) and (not actor.transparent)
# ƒAƒNƒ^[‚ÌÀ•W‚ªˆÚ“®æ‚ƈê’v‚µ‚½ê‡
if actor.x == new_x and actor.y == new_y
# Ž©•ª‚ªƒCƒxƒ“ƒg‚Ìê‡
if self != $game_player
# ’Ês•s‰Â
return false
end
end
end
end
end
return result
end
end
end
class Game_Event
include Train_Actor::Game_Event_Module
end
# Game_Party_Module.rb
# Train_Actor::Game_Party_Module
# Game_Party—p‘à—ñ•àsƒ‚ƒWƒ…[ƒ‹
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
module Game_Party_Module
attr_reader :characters
def dead_actor_include?
for actor in actors
if actor.dead?
return true
end
end
return false
end
def get_active_party_order
if not dead_actor_include?
return actors
end
alive_actors = []
dead_actors = []
for actor in actors
if actor.dead?
dead_actors.push actor
else
alive_actors.push actor
end
end
return alive_actors + dead_actors
end
def setup_actor_character_sprites
if @characters.nil?
@characters = []
for i in 1 ... TRAIN_ACTOR_SIZE_MAX
@characters.push(Game_Party_Actor.new(i - 1))
end
end
setup_actors = get_active_party_order
for i in 1 .. @characters.size
@characters[i - 1].setup(setup_actors)
end
if $scene.class.method_defined?('setup_actor_character_sprites')
$scene.setup_actor_character_sprites(@characters)
end
end
def transparent_switch
if TRANSPARENT_SWITCH
unless $game_player.transparent
return $game_switches[TRANSPARENT_SWITCHES_INDEX]
end
end
return $game_player.transparent
end
def update_party_actors
setup_actor_character_sprites
transparent = transparent_switch
for character in @characters
character.transparent = transparent
character.update
end
end
def moveto_party_actors( x, y )
setup_actor_character_sprites
for character in @characters
character.moveto( x, y )
end
@move_list = []
move_list_setup
end
def move_party_actors
if @move_list == nil
@move_list = []
move_list_setup
end
@move_list.each_index do |i|
if not @characters.nil?
@characters.add_move_list_element(@move_list)
end
end
end
class Move_List_Element
def initialize(type,args)
@type = type
@args = args
end
def type() return @type end
def args() return @args end
end
def move_list_setup
for i in 0 .. TRAIN_ACTOR_SIZE_MAX
@move_list = nil
end
end
def add_move_list(type,*args)
@move_list.unshift(Move_List_Element.new(type,args)).pop
end
def move_down_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::DOWN,turn_enabled)
end
def move_left_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::LEFT,turn_enabled)
end
def move_right_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::RIGHT,turn_enabled)
end
def move_up_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::UP,turn_enabled)
end
def move_lower_left_party_actors
move_party_actors
add_move_list(DOWN_LEFT)
end
def move_lower_right_party_actors
move_party_actors
add_move_list(DOWN_RIGHT)
end
def move_upper_left_party_actors
move_party_actors
add_move_list(UP_LEFT)
end
def move_upper_right_party_actors
move_party_actors
add_move_list(UP_RIGHT)
end
def jump_party_actors(x_plus, y_plus)
move_party_actors
add_move_list(JUMP,x_plus, y_plus)
move_stop_party_actors
end
def move_stop_party_actors
actors.each do |a|
move_party_actors
add_move_list(STOP)
end
end
end
end
class Game_Party
include Train_Actor::Game_Party_Module
# ƒAƒNƒ^[‚ð‰Á‚¦‚é
# actor_id:: ƒAƒNƒ^[ ID
def add_actor(actor_id)
# ƒAƒNƒ^[‚ðŽæ“¾
actor = $game_actors[actor_id]
# ƒp[ƒeƒBl”‚ª 4 l–¢–ž‚ÅA‚±‚̃AƒNƒ^[‚ªƒp[ƒeƒB‚É‚¢‚È‚¢ê‡
if @actors.size < Train_Actor::TRAIN_ACTOR_SIZE_MAX and not @actors.include?(actor)
# ƒAƒNƒ^[‚ð’ljÁ
@actors.push(actor)
# ƒvƒŒƒCƒ„[‚ðƒŠƒtƒŒƒbƒVƒ…
$game_player.refresh
end
end
end
# Game_Player_Module.rb
# Train_Actor::Game_Player_Module
# Game_Player—p‘à—ñ•àsƒ‚ƒWƒ…[ƒ‹
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
module Game_Player_Module
attr_reader :move_speed
attr_reader :step_anime
attr_reader :direction_fix
def update_party_actors
if $game_party.actors.empty?
return
end
$game_party.update_party_actors
actor = $game_party.actors[0]
if not actor.dead?
if not @prev_dead.nil?
@character_name = actor.character_name
@character_hue = actor.character_hue
@prev_dead = nil
end
return
end
@prev_dead = true
$game_party.actors.each do |actor|
if not actor.dead?
@character_name = actor.character_name
@character_hue = actor.character_hue
break
end
end
end
def update
update_party_actors
super
end
def moveto( x, y )
$game_party.moveto_party_actors( x, y )
super( x, y )
end
def move_down(turn_enabled = true)
if passable?(@x, @y, Input::DOWN)
$game_party.move_down_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_left(turn_enabled = true)
if passable?(@x, @y, Input::LEFT)
$game_party.move_left_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_right(turn_enabled = true)
if passable?(@x, @y, Input::RIGHT)
$game_party.move_right_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_up(turn_enabled = true)
if passable?(@x, @y, Input::UP)
$game_party.move_up_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_lower_left
# ‰º¨¶A¶¨‰º ‚Ì‚Ç‚¿‚ç‚©‚̃R[ƒX‚ª’Ês‰Â”\‚Èê‡
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))
$game_party.move_lower_left_party_actors
end
super
end
def move_lower_right
# ‰º¨‰EA‰E¨‰º ‚Ì‚Ç‚¿‚ç‚©‚̃R[ƒX‚ª’Ês‰Â”\‚Èê‡
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))
$game_party.move_lower_right_party_actors
end
super
end
def move_upper_left
# 㨶A¶¨ã ‚Ì‚Ç‚¿‚ç‚©‚̃R[ƒX‚ª’Ês‰Â”\‚Èê‡
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))
$game_party.move_upper_left_party_actors
end
super
end
def move_upper_right
# 㨉EA‰E¨ã ‚Ì‚Ç‚¿‚ç‚©‚̃R[ƒX‚ª’Ês‰Â”\‚Èê‡
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))
$game_party.move_upper_right_party_actors
end
super
end
def jump(x_plus, y_plus)
# V‚µ‚¢À•W‚ðŒvŽZ
new_x = @x + x_plus
new_y = @y + y_plus
# ‰ÁŽZ’l‚ª (0,0) ‚Ìꇂ©AƒWƒƒƒ“ƒv悪’Ês‰Â”\‚Èê‡
if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
$game_party.jump_party_actors(x_plus, y_plus)
end
super(x_plus, y_plus)
end
end
end
class Game_Player
include Train_Actor::Game_Player_Module
end
# Scene_Map_Module.rb
# Train_Actor::Scene_Map_Module
# Scene_Map—p‘à—ñ•àsƒ‚ƒWƒ…[ƒ‹
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
module Scene_Map_Module
def setup_actor_character_sprites(characters)
@spriteset.setup_actor_character_sprites(characters)
end
end
end
class Scene_Map
include Train_Actor::Scene_Map_Module
end
# Spriteset_Map_Module.rb
# Train_Actor::Spriteset_Map_Module
# Spriteset_Map—p‘à—ñ•àsƒ‚ƒWƒ…[ƒ‹
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
module Spriteset_Map_Module
def setup_actor_character_sprites?
return @setup_actor_character_sprites_flag != nil
end
def setup_actor_character_sprites(characters)
if not setup_actor_character_sprites?
for character in characters.reverse
@character_sprites.unshift(Sprite_Character.new(@viewport1, character))
end
@setup_actor_character_sprites_flag = true
end
end
end
end
class Spriteset_Map
include Train_Actor::Spriteset_Map_Module
end
# Game_Party_Actor.rb
# Train_Actor::Game_Party_Actor
# ƒ}ƒbƒvã‚̃p[ƒeƒB—pƒLƒƒƒ‰ƒNƒ^[
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
class Game_Party_Actor < Game_Character
def initialize(character_index)
super()
@character_index = character_index
@character_wait = 0
@through = true
# •s“§–¾“x‚Ƈ¬•û–@‚ð‰Šú‰»
@opacity = 255
@blend_type = 0
@move_list = []
end
def setup(actor)
# ƒLƒƒƒ‰ƒNƒ^[‚̃tƒ@ƒCƒ‹–¼‚ÆF‘Š‚ðÝ’è
if actor.nil?
@character_name = ""
@character_hue = 0
elsif not actor.dead? # Ž€‚ñ‚Å‚éê‡‚Æ‚è‚ ‚¦‚¸AÁ‚µ‚Æ‚±c
@character_name = actor.character_name
@character_hue = actor.character_hue
else
@character_name = DEAD_CHARACTER_NAME
@character_hue = 0
end
end
def update
@move_speed = $game_player.move_speed
@step_anime = $game_player.step_anime
@opacity = $game_player.opacity
@blend_type = $game_player.blend_type
@direction_fix = $game_player.direction_fix
if @direction_fix
@direction = $game_player.direction
end
update_move_list()
super
end
def screen_z(height = 0)
if $game_player.screen_z(height) == 999
return 998
end
if $game_player.x == @x and $game_player.y == @y
super(height) - 1
else
super(height)
end
end
def add_move_list_element(element)
@move_list.push(element)
if @move_list.size == 1
update_move_list()
end
end
def move_list_size
return @move_list.size
end
def update_move_list()
return if moving?
return if @move_list.empty?
if @move_list[0].type == STOP
if @character_index != 0
character = $game_party.characters[@character_index - 1]
if character.x == @x and character.y == @y and character.direction == @direction
@character_wait = 128 / (2 ** @move_speed) + 1
while character.move_list_size < @move_list.size and @move_list[0].type == STOP
@move_list.shift
end
end
end
else
@character_wait = 0
end
if @character_wait > 0
@character_wait -= 1
return
end
element = @move_list.shift
while element.type == STOP
element = @move_list.shift
end
case element.type
when Input::DOWN
move_down(element.args[0])
when Input::LEFT
move_left(element.args[0])
when Input::RIGHT
move_right(element.args[0])
when Input::UP
move_up(element.args[0])
when DOWN_LEFT
move_lower_left
when DOWN_RIGHT
move_lower_right
when UP_LEFT
move_upper_left
when UP_RIGHT
move_upper_right
when JUMP
jump(element.args[0],element.args[1])
end
end
def moveto( x, y )
@move_list.clear
super(x, y)
end
#--------------------------------------------------------------------------
# œ ‰º‚Ɉړ®
# turn_enabled : ‚»‚Ìê‚Å‚ÌŒü‚«•ÏX‚ð‹–‰Â‚·‚éƒtƒ‰ƒO
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
# ‰º‚ðŒü‚
if turn_enabled
turn_down
end
# ’Ês‰Â”\‚Èê‡
if passable?(@x, @y, Input::DOWN)
# ‰º‚ðŒü‚
turn_down
# À•W‚ðXV
@y = (@y + 1 + $game_map.height) % ($game_map.height)
@real_y = (@y - 1) * 128
end
end
#--------------------------------------------------------------------------
# œ ¶‚Ɉړ®
# turn_enabled : ‚»‚Ìê‚Å‚ÌŒü‚«•ÏX‚ð‹–‰Â‚·‚éƒtƒ‰ƒO
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
# ¶‚ðŒü‚
if turn_enabled
turn_left
end
# ’Ês‰Â”\‚Èê‡
if passable?(@x, @y, Input::LEFT)
# ¶‚ðŒü‚
turn_left
# À•W‚ðXV
@x = (@x - 1 + $game_map.width) % ($game_map.width)
@real_x = (@x + 1) * 128
end
end
#--------------------------------------------------------------------------
# œ ‰E‚Ɉړ®
# turn_enabled : ‚»‚Ìê‚Å‚ÌŒü‚«•ÏX‚ð‹–‰Â‚·‚éƒtƒ‰ƒO
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
# ‰E‚ðŒü‚
if turn_enabled
turn_right
end
# ’Ês‰Â”\‚Èê‡
if passable?(@x, @y, Input::RIGHT)
# ‰E‚ðŒü‚
turn_right
# À•W‚ðXV
@x = (@x + 1 + $game_map.width) % ($game_map.width)
@real_x = (@x - 1) * 128
end
end
#--------------------------------------------------------------------------
# œ ã‚Ɉړ®
# turn_enabled : ‚»‚Ìê‚Å‚ÌŒü‚«•ÏX‚ð‹–‰Â‚·‚éƒtƒ‰ƒO
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
# ã‚ðŒü‚
if turn_enabled
turn_up
end
# ’Ês‰Â”\‚Èê‡
if passable?(@x, @y, Input::UP)
# ã‚ðŒü‚
turn_up
# À•W‚ðXV
@y = (@y - 1 + $game_map.height) % ($game_map.height)
@real_y = (@y + 1) * 128
end
end
end
end
=begin
‚c‚pƒVƒXƒeƒ€ƒXƒNƒŠƒvƒg Train_Actor
Author:: yf30 at users.sourceforge.jp (http://sourceforge.jp/users/yf30/)
Date:: 2009/02/26
Copyright:: Copyright (C) 2004-2009 rgss-lib
URL:: http://sourceforge.jp/projects/rgss-lib/
=end
# dq
# train_actor
# Config.rb
#==============================================================================
# ¡ Train_Actor::Config
#------------------------------------------------------------------------------
# ƒ}ƒbƒvã‚ŃAƒNƒ^[‚ð‘à—ñˆÚ“®‚³‚¹‚é
#==============================================================================
module Train_Actor
# œ“§–¾ó‘Ô—pƒXƒCƒbƒ`Ý’è
# true ‚¾‚ƃXƒCƒbƒ`§Œä‚ðs‚¤
#TRANSPARENT_SWITCH = true
TRANSPARENT_SWITCH = false
# œ“§–¾ó‘Ô—pƒXƒCƒbƒ`”Ô†
# TRANSPARENT_SWITCH ‚ª true ‚ÅA‚±‚̔Ԇ‚̃XƒCƒbƒ`‚ªON‚¾‚Æ“§–¾‚É‚È‚é
TRANSPARENT_SWITCHES_INDEX = 20
# œƒAƒNƒ^[‚ÌÅ‘å”
# «—ˆ“I‚É‘½l”ƒp[ƒeƒB‚ªo—ˆ‚é‚悤‚É‚È‚Á‚½‚çc
TRAIN_ACTOR_SIZE_MAX = 4
# Ž€–SŽž‚̃Lƒƒƒ‰ƒNƒ^[ƒOƒ‰ƒtƒBƒbƒN–¼
#DEAD_CHARACTER_NAME = "Coffin"
DEAD_CHARACTER_NAME = ""
# ’è”
DOWN_LEFT = 1
DOWN_RIGHT = 3
UP_LEFT = 7
UP_RIGHT = 9
JUMP = 5
STOP = 0
end
# rgss
# Game_Event_Module.rb
# Game_Event_Module
# ƒ}ƒbƒvã‚ŃAƒNƒ^[‚ð‘à—ñˆÚ“®‚³‚¹‚é
# Author:: fukuyama
# Date:: 2006/03/05
# Copyright:: Copyright (C) 2005 fukuyama
module Train_Actor
module Game_Event_Module
# ’Ês‰Â”\”»’è
# x:: X À•W
# y:: Y À•W
# d:: •ûŒü (0,2,4,6,8) ¦ 0 = ‘S•ûŒü’Ês•s‰Â‚Ìꇂ𔻒è (ƒWƒƒƒ“ƒv—p)
# return:: ’Ês•s‰Â false ‰Â”\ true
def passable?(x, y, d)
result = super(x, y, d)
return result if @through
if result
# V‚µ‚¢À•W‚ð‹‚ß‚é
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
# ƒgƒŒƒCƒ“ƒAƒNƒ^[‚̃‹[ƒv
for actor in $game_party.characters
# •\Ž¦‚³‚ê‚Ä‚¢‚éê‡
if (not actor.character_name.empty?) and (not actor.transparent)
# ƒAƒNƒ^[‚ÌÀ•W‚ªˆÚ“®æ‚ƈê’v‚µ‚½ê‡
if actor.x == new_x and actor.y == new_y
# Ž©•ª‚ªƒCƒxƒ“ƒg‚Ìê‡
if self != $game_player
# ’Ês•s‰Â
return false
end
end
end
end
end
return result
end
end
end
class Game_Event
include Train_Actor::Game_Event_Module
end
# Game_Party_Module.rb
# Train_Actor::Game_Party_Module
# Game_Party—p‘à—ñ•àsƒ‚ƒWƒ…[ƒ‹
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
module Game_Party_Module
attr_reader :characters
def dead_actor_include?
for actor in actors
if actor.dead?
return true
end
end
return false
end
def get_active_party_order
if not dead_actor_include?
return actors
end
alive_actors = []
dead_actors = []
for actor in actors
if actor.dead?
dead_actors.push actor
else
alive_actors.push actor
end
end
return alive_actors + dead_actors
end
def setup_actor_character_sprites
if @characters.nil?
@characters = []
for i in 1 ... TRAIN_ACTOR_SIZE_MAX
@characters.push(Game_Party_Actor.new(i - 1))
end
end
setup_actors = get_active_party_order
for i in 1 .. @characters.size
@characters[i - 1].setup(setup_actors)
end
if $scene.class.method_defined?('setup_actor_character_sprites')
$scene.setup_actor_character_sprites(@characters)
end
end
def transparent_switch
if TRANSPARENT_SWITCH
unless $game_player.transparent
return $game_switches[TRANSPARENT_SWITCHES_INDEX]
end
end
return $game_player.transparent
end
def update_party_actors
setup_actor_character_sprites
transparent = transparent_switch
for character in @characters
character.transparent = transparent
character.update
end
end
def moveto_party_actors( x, y )
setup_actor_character_sprites
for character in @characters
character.moveto( x, y )
end
@move_list = []
move_list_setup
end
def move_party_actors
if @move_list == nil
@move_list = []
move_list_setup
end
@move_list.each_index do |i|
if not @characters.nil?
@characters.add_move_list_element(@move_list)
end
end
end
class Move_List_Element
def initialize(type,args)
@type = type
@args = args
end
def type() return @type end
def args() return @args end
end
def move_list_setup
for i in 0 .. TRAIN_ACTOR_SIZE_MAX
@move_list = nil
end
end
def add_move_list(type,*args)
@move_list.unshift(Move_List_Element.new(type,args)).pop
end
def move_down_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::DOWN,turn_enabled)
end
def move_left_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::LEFT,turn_enabled)
end
def move_right_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::RIGHT,turn_enabled)
end
def move_up_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::UP,turn_enabled)
end
def move_lower_left_party_actors
move_party_actors
add_move_list(DOWN_LEFT)
end
def move_lower_right_party_actors
move_party_actors
add_move_list(DOWN_RIGHT)
end
def move_upper_left_party_actors
move_party_actors
add_move_list(UP_LEFT)
end
def move_upper_right_party_actors
move_party_actors
add_move_list(UP_RIGHT)
end
def jump_party_actors(x_plus, y_plus)
move_party_actors
add_move_list(JUMP,x_plus, y_plus)
move_stop_party_actors
end
def move_stop_party_actors
actors.each do |a|
move_party_actors
add_move_list(STOP)
end
end
end
end
class Game_Party
include Train_Actor::Game_Party_Module
# ƒAƒNƒ^[‚ð‰Á‚¦‚é
# actor_id:: ƒAƒNƒ^[ ID
def add_actor(actor_id)
# ƒAƒNƒ^[‚ðŽæ“¾
actor = $game_actors[actor_id]
# ƒp[ƒeƒBl”‚ª 4 l–¢–ž‚ÅA‚±‚̃AƒNƒ^[‚ªƒp[ƒeƒB‚É‚¢‚È‚¢ê‡
if @actors.size < Train_Actor::TRAIN_ACTOR_SIZE_MAX and not @actors.include?(actor)
# ƒAƒNƒ^[‚ð’ljÁ
@actors.push(actor)
# ƒvƒŒƒCƒ„[‚ðƒŠƒtƒŒƒbƒVƒ…
$game_player.refresh
end
end
end
# Game_Player_Module.rb
# Train_Actor::Game_Player_Module
# Game_Player—p‘à—ñ•àsƒ‚ƒWƒ…[ƒ‹
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
module Game_Player_Module
attr_reader :move_speed
attr_reader :step_anime
attr_reader :direction_fix
def update_party_actors
if $game_party.actors.empty?
return
end
$game_party.update_party_actors
actor = $game_party.actors[0]
if not actor.dead?
if not @prev_dead.nil?
@character_name = actor.character_name
@character_hue = actor.character_hue
@prev_dead = nil
end
return
end
@prev_dead = true
$game_party.actors.each do |actor|
if not actor.dead?
@character_name = actor.character_name
@character_hue = actor.character_hue
break
end
end
end
def update
update_party_actors
super
end
def moveto( x, y )
$game_party.moveto_party_actors( x, y )
super( x, y )
end
def move_down(turn_enabled = true)
if passable?(@x, @y, Input::DOWN)
$game_party.move_down_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_left(turn_enabled = true)
if passable?(@x, @y, Input::LEFT)
$game_party.move_left_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_right(turn_enabled = true)
if passable?(@x, @y, Input::RIGHT)
$game_party.move_right_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_up(turn_enabled = true)
if passable?(@x, @y, Input::UP)
$game_party.move_up_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_lower_left
# ‰º¨¶A¶¨‰º ‚Ì‚Ç‚¿‚ç‚©‚̃R[ƒX‚ª’Ês‰Â”\‚Èê‡
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))
$game_party.move_lower_left_party_actors
end
super
end
def move_lower_right
# ‰º¨‰EA‰E¨‰º ‚Ì‚Ç‚¿‚ç‚©‚̃R[ƒX‚ª’Ês‰Â”\‚Èê‡
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))
$game_party.move_lower_right_party_actors
end
super
end
def move_upper_left
# 㨶A¶¨ã ‚Ì‚Ç‚¿‚ç‚©‚̃R[ƒX‚ª’Ês‰Â”\‚Èê‡
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))
$game_party.move_upper_left_party_actors
end
super
end
def move_upper_right
# 㨉EA‰E¨ã ‚Ì‚Ç‚¿‚ç‚©‚̃R[ƒX‚ª’Ês‰Â”\‚Èê‡
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))
$game_party.move_upper_right_party_actors
end
super
end
def jump(x_plus, y_plus)
# V‚µ‚¢À•W‚ðŒvŽZ
new_x = @x + x_plus
new_y = @y + y_plus
# ‰ÁŽZ’l‚ª (0,0) ‚Ìꇂ©AƒWƒƒƒ“ƒv悪’Ês‰Â”\‚Èê‡
if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
$game_party.jump_party_actors(x_plus, y_plus)
end
super(x_plus, y_plus)
end
end
end
class Game_Player
include Train_Actor::Game_Player_Module
end
# Scene_Map_Module.rb
# Train_Actor::Scene_Map_Module
# Scene_Map—p‘à—ñ•àsƒ‚ƒWƒ…[ƒ‹
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
module Scene_Map_Module
def setup_actor_character_sprites(characters)
@spriteset.setup_actor_character_sprites(characters)
end
end
end
class Scene_Map
include Train_Actor::Scene_Map_Module
end
# Spriteset_Map_Module.rb
# Train_Actor::Spriteset_Map_Module
# Spriteset_Map—p‘à—ñ•àsƒ‚ƒWƒ…[ƒ‹
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
module Spriteset_Map_Module
def setup_actor_character_sprites?
return @setup_actor_character_sprites_flag != nil
end
def setup_actor_character_sprites(characters)
if not setup_actor_character_sprites?
for character in characters.reverse
@character_sprites.unshift(Sprite_Character.new(@viewport1, character))
end
@setup_actor_character_sprites_flag = true
end
end
end
end
class Spriteset_Map
include Train_Actor::Spriteset_Map_Module
end
# Game_Party_Actor.rb
# Train_Actor::Game_Party_Actor
# ƒ}ƒbƒvã‚̃p[ƒeƒB—pƒLƒƒƒ‰ƒNƒ^[
# Author:: fukuyama
# Date:: 2007/12/31
# Copyright:: Copyright (C) 2005-2007 rgss-lib
module Train_Actor
class Game_Party_Actor < Game_Character
def initialize(character_index)
super()
@character_index = character_index
@character_wait = 0
@through = true
# •s“§–¾“x‚Ƈ¬•û–@‚ð‰Šú‰»
@opacity = 255
@blend_type = 0
@move_list = []
end
def setup(actor)
# ƒLƒƒƒ‰ƒNƒ^[‚̃tƒ@ƒCƒ‹–¼‚ÆF‘Š‚ðÝ’è
if actor.nil?
@character_name = ""
@character_hue = 0
elsif not actor.dead? # Ž€‚ñ‚Å‚éê‡‚Æ‚è‚ ‚¦‚¸AÁ‚µ‚Æ‚±c
@character_name = actor.character_name
@character_hue = actor.character_hue
else
@character_name = DEAD_CHARACTER_NAME
@character_hue = 0
end
end
def update
@move_speed = $game_player.move_speed
@step_anime = $game_player.step_anime
@opacity = $game_player.opacity
@blend_type = $game_player.blend_type
@direction_fix = $game_player.direction_fix
if @direction_fix
@direction = $game_player.direction
end
update_move_list()
super
end
def screen_z(height = 0)
if $game_player.screen_z(height) == 999
return 998
end
if $game_player.x == @x and $game_player.y == @y
super(height) - 1
else
super(height)
end
end
def add_move_list_element(element)
@move_list.push(element)
if @move_list.size == 1
update_move_list()
end
end
def move_list_size
return @move_list.size
end
def update_move_list()
return if moving?
return if @move_list.empty?
if @move_list[0].type == STOP
if @character_index != 0
character = $game_party.characters[@character_index - 1]
if character.x == @x and character.y == @y and character.direction == @direction
@character_wait = 128 / (2 ** @move_speed) + 1
while character.move_list_size < @move_list.size and @move_list[0].type == STOP
@move_list.shift
end
end
end
else
@character_wait = 0
end
if @character_wait > 0
@character_wait -= 1
return
end
element = @move_list.shift
while element.type == STOP
element = @move_list.shift
end
case element.type
when Input::DOWN
move_down(element.args[0])
when Input::LEFT
move_left(element.args[0])
when Input::RIGHT
move_right(element.args[0])
when Input::UP
move_up(element.args[0])
when DOWN_LEFT
move_lower_left
when DOWN_RIGHT
move_lower_right
when UP_LEFT
move_upper_left
when UP_RIGHT
move_upper_right
when JUMP
jump(element.args[0],element.args[1])
end
end
def moveto( x, y )
@move_list.clear
super(x, y)
end
#--------------------------------------------------------------------------
# œ ‰º‚Ɉړ®
# turn_enabled : ‚»‚Ìê‚Å‚ÌŒü‚«•ÏX‚ð‹–‰Â‚·‚éƒtƒ‰ƒO
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
# ‰º‚ðŒü‚
if turn_enabled
turn_down
end
# ’Ês‰Â”\‚Èê‡
if passable?(@x, @y, Input::DOWN)
# ‰º‚ðŒü‚
turn_down
# À•W‚ðXV
@y = (@y + 1 + $game_map.height) % ($game_map.height)
@real_y = (@y - 1) * 128
end
end
#--------------------------------------------------------------------------
# œ ¶‚Ɉړ®
# turn_enabled : ‚»‚Ìê‚Å‚ÌŒü‚«•ÏX‚ð‹–‰Â‚·‚éƒtƒ‰ƒO
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
# ¶‚ðŒü‚
if turn_enabled
turn_left
end
# ’Ês‰Â”\‚Èê‡
if passable?(@x, @y, Input::LEFT)
# ¶‚ðŒü‚
turn_left
# À•W‚ðXV
@x = (@x - 1 + $game_map.width) % ($game_map.width)
@real_x = (@x + 1) * 128
end
end
#--------------------------------------------------------------------------
# œ ‰E‚Ɉړ®
# turn_enabled : ‚»‚Ìê‚Å‚ÌŒü‚«•ÏX‚ð‹–‰Â‚·‚éƒtƒ‰ƒO
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
# ‰E‚ðŒü‚
if turn_enabled
turn_right
end
# ’Ês‰Â”\‚Èê‡
if passable?(@x, @y, Input::RIGHT)
# ‰E‚ðŒü‚
turn_right
# À•W‚ðXV
@x = (@x + 1 + $game_map.width) % ($game_map.width)
@real_x = (@x - 1) * 128
end
end
#--------------------------------------------------------------------------
# œ ã‚Ɉړ®
# turn_enabled : ‚»‚Ìê‚Å‚ÌŒü‚«•ÏX‚ð‹–‰Â‚·‚éƒtƒ‰ƒO
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
# ã‚ðŒü‚
if turn_enabled
turn_up
end
# ’Ês‰Â”\‚Èê‡
if passable?(@x, @y, Input::UP)
# ã‚ðŒü‚
turn_up
# À•W‚ðXV
@y = (@y - 1 + $game_map.height) % ($game_map.height)
@real_y = (@y + 1) * 128
end
end
end
end