赞 | 0 |
VIP | 46 |
好人卡 | 26 |
积分 | 7 |
经验 | 76056 |
最后登录 | 2024-11-23 |
在线时间 | 2658 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 653
- 在线时间
- 2658 小时
- 注册时间
- 2010-6-28
- 帖子
- 1361
|
我只有脚本= =- #==============================================================================
- # ■ Train_Actor::Config
- #------------------------------------------------------------------------------
- # マップ上でアクターを隊列移動させる
- #==============================================================================
- module Train_Actor
- # ●后面跟随的人看不见时的开关状态
- # true 的时候就是看不见后面的人
- #TRANSPARENT_SWITCH = true
- TRANSPARENT_SWITCH = true
- # ●让后面的人看不见的开关
- # TRANSPARENT_SWITCH为true时后面的人看不见
- TRANSPARENT_SWITCHES_INDEX = 96
- # 角色死亡时的行走图名称
- #DEAD_CHARACTER_NAME = "Coffin"
- #角色序列
- #DEAD_CHARACTER_INDEX = 0
- DEAD_CHARACTER_NAME = ""
- DEAD_CHARACTER_INDEX = 0
- # 定数
- DOWN_LEFT = 1
- DOWN_RIGHT = 3
- UP_LEFT = 7
- UP_RIGHT = 9
- JUMP = 5
- STOP = 0
- end
-
- # Train_Actor::Game_Event_Module
- # マップ上でアクターを隊列移動させる
- # Author:: fukuyama
- # Date:: 2007/12/31
- # Copyright:: Copyright (C) 2005-2007 rgss-lib
- module Train_Actor
- module Game_Event_Module
- # 通行可能判定
- # x:: X 座標
- # y:: Y 座標
- # return:: 通行不可 false 可能 true
- def passable?(x, y)
- result = super(x, y)
- return result if @through
- if result
- # 新しい座標を求める
- new_x = x
- new_y = y
- # トレインアクターのループ
- for actor in $game_party.characters
- # 表示されている場合
- if (not actor.character_name.empty?) and (not actor.transparent)
- # アクターの座標が移動先と一致した場合
- if actor.x == new_x and actor.y == new_y
- # 自分がイベントの場合
- if self != $game_player
- # 通行不可
- return false
- end
- end
- end
- end
- end
- return result
- end
- end
- end
- class Game_Event
- include Train_Actor::Game_Event_Module
- end
- # Train_Actor::Game_Party_Module
- # Game_Party用隊列歩行モジュール
- # Author:: fukuyama
- # Date:: 2007/12/31
- # Copyright:: Copyright (C) 2005-2007 rgss-lib
- module Train_Actor
- module Game_Party_Module
- attr_reader :characters
- def initialize
- super
- if @characters.nil?
- @characters = []
- for i in 1 ... Game_Party::MAX_MEMBERS
- @characters.push(Game_Party_Actor.new(i - 1))
- end
- end
- end
- def empty?
- return @actors.empty?
- end
- def dead_actor_include?
- for actor in members
- if actor.dead?
- return true
- end
- end
- return false
- end
- def get_active_party_order
- if not dead_actor_include?
- return members
- end
- alive_actors = []
- dead_actors = []
- for actor in members
- 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
- setup_actors = get_active_party_order
- for i in 1 ... Game_Party::MAX_MEMBERS
- @characters[i - 1].setup(setup_actors[i])
- 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
- if $game_player.vehicle_type >= 0 # 乗り物に乗ってる時は同期
- character.sync_with_player
- end
- 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[i].nil?
- @characters[i].add_move_list_element(@move_list[i])
- 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 .. Game_Party::MAX_MEMBERS
- @move_list[i] = nil
- end
- end
- def add_move_list(type,*args)
- if $game_player.vehicle_type >= 0 # 乗り物に乗ってる時は同期
- move_list_setup
- return
- end
- @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
- self.members.each do |a|
- move_party_actors
- add_move_list(STOP)
- end
- end
- end
- end
- class Game_Party
- include Train_Actor::Game_Party_Module
- end
- # Train_Actor::Game_Player_Module
- # Game_Player用隊列歩行モジュール
- # 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.empty?
- return
- end
- $game_party.update_party_actors
- actors = $game_party.members
- actor = actors[0]
- if not actor.dead?
- if not @prev_dead.nil?
- @character_name = actor.character_name
- @character_index = actor.character_index
- @prev_dead = nil
- end
- return
- end
- @prev_dead = true
- actors.each do |actor|
- if not actor.dead?
- @character_name = actor.character_name
- @character_index = actor.character_index
- 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 + 1)
- $game_party.move_down_party_actors(turn_enabled)
- end
- super(turn_enabled)
- end
- def move_left(turn_enabled = true)
- if passable?(@x - 1, @y)
- $game_party.move_left_party_actors(turn_enabled)
- end
- super(turn_enabled)
- end
- def move_right(turn_enabled = true)
- if passable?(@x + 1, @y)
- $game_party.move_right_party_actors(turn_enabled)
- end
- super(turn_enabled)
- end
- def move_up(turn_enabled = true)
- if passable?(@x, @y - 1)
- $game_party.move_up_party_actors(turn_enabled)
- end
- super(turn_enabled)
- end
- def move_lower_left
- # 下→左、左→下 のどちらかのコースが通行可能な場合
- if (passable?(@x, @y+1) and passable?(@x-1, @y+1)) or
- (passable?(@x-1, @y) and passable?(@x-1, @y+1))
- $game_party.move_lower_left_party_actors
- end
- super
- end
- def move_lower_right
- # 下→右、右→下 のどちらかのコースが通行可能な場合
- if (passable?(@x, @y+1) and passable?(@x+1, @y+1)) or
- (passable?(@x+1, @y) and passable?(@x+1, @y+1))
- $game_party.move_lower_right_party_actors
- end
- super
- end
- def move_upper_left
- # 上→左、左→上 のどちらかのコースが通行可能な場合
- if (passable?(@x, @y-1) and passable?(@x-1, @y-1)) or
- (passable?(@x-1, @y) and passable?(@x-1, @y-1))
- $game_party.move_upper_left_party_actors
- end
- super
- end
- def move_upper_right
- # 上→右、右→上 のどちらかのコースが通行可能な場合
- if (passable?(@x, @y-1) and passable?(@x+1, @y-1)) or
- (passable?(@x+1, @y) and passable?(@x+1, @y-1))
- $game_party.move_upper_right_party_actors
- end
- super
- end
- def jump(x_plus, y_plus)
- # 新しい座標を計算
- new_x = @x + x_plus
- new_y = @y + y_plus
- # 加算値が (0,0) の場合か、ジャンプ先が通行可能な場合
- if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y)
- $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
- # Train_Actor::Spriteset_Map_Module
- # Spriteset_Map用隊列歩行モジュール
- # 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
- for character in $game_party.characters.reverse
- @character_sprites.unshift(Sprite_Character.new(@viewport1, character))
- end
- end
- end
- end
- class Spriteset_Map
- include Train_Actor::Spriteset_Map_Module
- alias train_actor_create_characters create_characters
- def create_characters
- train_actor_create_characters
- setup_actor_character_sprites
- end
- end
- # Train_Actor::Game_Party_Actor
- # マップ上のパーティ用キャラクター
- # Author:: fukuyama
- # Date:: 2007/12/31
- # Copyright:: Copyright (C) 2005-2007 rgss-lib
- module Train_Actor
- class Game_Party_Actor < Game_Character
- def initialize(train_index)
- super()
- @train_index = train_index
- @character_wait = 0
- @through = true
- # 不透明度と合成方法を初期化
- @opacity = 255
- @blend_type = 0
- @move_list = []
- end
- def setup(actor)
- # キャラクターのファイル名と色相を設定
- if actor.nil?
- @character_name = ""
- elsif not actor.dead? # 死んでる場合とりあえず、消しとこ…
- @character_name = actor.character_name
- @character_index = actor.character_index
- else
- @character_name = DEAD_CHARACTER_NAME
- @character_index = DEAD_CHARACTER_INDEX
- end
- end
- def dash?
- return false if $game_map.disable_dash?
- # return false if $game_player.move_route_forcing
- return Input.press?(Input::A)
- 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.x == @x and $game_player.y == @y
- super() - 1
- else
- super()
- 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 @train_index != 0
- character = $game_party.characters[@train_index - 1]
- if character.x == @x and character.y == @y and character.direction == @direction
- distance = (2 ** @move_speed)
- distance *= 2 if dash?
- @character_wait = 256 / distance + 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
- if dash?
- @character_wait -= 2
- else
- @character_wait -= 1
- end
- return
- end
- element = @move_list.shift
- 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])
- when STOP
- update_move_list()
- end
- end
- def moveto( x, y )
- @move_list.clear
- super(x, y)
- end
- #--------------------------------------------------------------------------
- # ● 下に移動
- # turn_enabled : その場での向き変更を許可するフラグ
- #--------------------------------------------------------------------------
- def move_down(turn_enabled = true)
- # 下を向く
- if turn_enabled
- turn_down
- end
- # 通行可能な場合
- if passable?(@x, @y + 1)
- # 下を向く
- turn_down
- # 座標を更新
- @y += 1
- end
- end
- #--------------------------------------------------------------------------
- # ● 左に移動
- # turn_enabled : その場での向き変更を許可するフラグ
- #--------------------------------------------------------------------------
- def move_left(turn_enabled = true)
- # 左を向く
- if turn_enabled
- turn_left
- end
- # 通行可能な場合
- if passable?(@x - 1, @y)
- # 左を向く
- turn_left
- # 座標を更新
- @x -= 1
- end
- end
- #--------------------------------------------------------------------------
- # ● 右に移動
- # turn_enabled : その場での向き変更を許可するフラグ
- #--------------------------------------------------------------------------
- def move_right(turn_enabled = true)
- # 右を向く
- if turn_enabled
- turn_right
- end
- # 通行可能な場合
- if passable?(@x + 1, @y)
- # 右を向く
- turn_right
- # 座標を更新
- @x += 1
- end
- end
- #--------------------------------------------------------------------------
- # ● 上に移動
- # turn_enabled : その場での向き変更を許可するフラグ
- #--------------------------------------------------------------------------
- def move_up(turn_enabled = true)
- # 上を向く
- if turn_enabled
- turn_up
- end
- # 通行可能な場合
- if passable?(@x, @y - 1)
- # 上を向く
- turn_up
- # 座標を更新
- @y -= 1
- end
- end
- #--------------------------------------------------------------------------
- # ● 左下に移動
- #--------------------------------------------------------------------------
- def move_lower_left
- # 向き固定でない場合
- unless @direction_fix
- # 右向きだった場合は左を、上向きだった場合は下を向く
- @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
- end
- # 下→左、左→下 のどちらかのコースが通行可能な場合
- if (passable?(@x, @y+1) and passable?(@x-1, @y+1)) or
- (passable?(@x-1, @y) and passable?(@x-1, @y+1))
- # 座標を更新
- @x -= 1
- @y += 1
- end
- end
- #--------------------------------------------------------------------------
- # ● 右下に移動
- #--------------------------------------------------------------------------
- def move_lower_right
- # 向き固定でない場合
- unless @direction_fix
- # 左向きだった場合は右を、上向きだった場合は下を向く
- @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
- end
- # 下→右、右→下 のどちらかのコースが通行可能な場合
- if (passable?(@x, @y+1) and passable?(@x+1, @y+1)) or
- (passable?(@x+1, @y) and passable?(@x+1, @y+1))
- # 座標を更新
- @x += 1
- @y += 1
- end
- end
- #--------------------------------------------------------------------------
- # ● 左上に移動
- #--------------------------------------------------------------------------
- def move_upper_left
- # 向き固定でない場合
- unless @direction_fix
- # 右向きだった場合は左を、下向きだった場合は上を向く
- @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
- end
- # 上→左、左→上 のどちらかのコースが通行可能な場合
- if (passable?(@x, @y-1) and passable?(@x-1, @y-1)) or
- (passable?(@x-1, @y) and passable?(@x-1, @y-1))
- # 座標を更新
- @x -= 1
- @y -= 1
- end
- end
- #--------------------------------------------------------------------------
- # ● 右上に移動
- #--------------------------------------------------------------------------
- def move_upper_right
- # 向き固定でない場合
- unless @direction_fix
- # 左向きだった場合は右を、下向きだった場合は上を向く
- @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
- end
- # 上→右、右→上 のどちらかのコースが通行可能な場合
- if (passable?(@x, @y-1) and passable?(@x+1, @y-1)) or
- (passable?(@x+1, @y) and passable?(@x+1, @y-1))
- # 座標を更新
- @x += 1
- @y -= 1
- end
- end
- def sync_with_player
- @x = $game_player.x
- @y = $game_player.y
- @real_x = $game_player.real_x
- @real_y = $game_player.real_y
- @direction = $game_player.direction
- update_bush_depth
- end
- end
- end
复制代码 |
|