| 
 
| 赞 | 4 |  
| VIP | 71 |  
| 好人卡 | 22 |  
| 积分 | 7 |  
| 经验 | 32145 |  
| 最后登录 | 2013-8-9 |  
| 在线时间 | 184 小时 |  
 Lv2.观梦者 天仙 
	梦石0 星屑680 在线时间184 小时注册时间2008-4-15帖子5023 
 | 
| 在你的脚本基础上又增加的功能 就是可以同时兼容VX和XP的行走图
 
 换句话说,阿尔西斯和拉尔夫可以面对面了{/tp}
 
 VX的行走图照原来的名称就行了
 XP单张行走图用 !# 开头
 XP8张格式行走图用 !% 开头
 
 其实实用性不大,只是好玩而已{/cy}
 
 
 复制代码class Game_Character
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  alias old_ini initialize
  def initialize
    old_ini
    @original_pattern = 2
  end
  #--------------------------------------------------------------------------
  # ● 矫正姿势
  #--------------------------------------------------------------------------
  def straighten
    @pattern = 2 if @walk_anime or @step_anime
    @anime_count = 0
  end
end
class Sprite_Character < Sprite_Base
  #--------------------------------------------------------------------------
  # ● 更新传送源的位图
  #--------------------------------------------------------------------------
  def update_bitmap
    if @tile_id != @character.tile_id or
       @character_name != @character.character_name or
       @character_index != @character.character_index
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_index = @character.character_index
      if @tile_id > 0
        sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
        sy = @tile_id % 256 / 8 % 16 * 32;
        self.bitmap = tileset_bitmap(@tile_id)
        self.src_rect.set(sx, sy, 32, 32)
        self.ox = 16
        self.oy = 32
      else
        self.bitmap = Cache.character(@character_name)
        sign = @character_name[/^[\!\$\#\%]./]
        if sign != nil
          # VX自带的单张行走图
          if sign.include?('$')
            @cw = bitmap.width / 3
            @ch = bitmap.height / 4
            @vx_or_xp = 0
          # XP的单张行走图
          elsif sign.include?('#')
            @cw = bitmap.width / 4
            @ch = bitmap.height / 4
            @vx_or_xp = 1
          # 用VX格式拼的8张XP的行走图
          else
            @cw = bitmap.width / 16
            @ch = bitmap.height / 8
            @vx_or_xp = 1
          end
          # VX的8张格式行走图
        else
          @cw = bitmap.width / 12
          @ch = bitmap.height / 8
          @vx_or_xp = 0
        end
        self.ox = @cw / 2
        self.oy = @ch
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # ● 更新传送源矩形
  #--------------------------------------------------------------------------
  def update_src_rect
    if @tile_id == 0
      index = @character.character_index
      # XP格式行走图
      if @vx_or_xp == 1
        pattern = @character.pattern < 4 ? @character.pattern : 1
        sx = (index % 4 * 4 + pattern) * @cw
      # VX格式行走图
      else
        pattern = @character.pattern < 3 ? @character.pattern : 1
        sx = (index % 4 * 3 + pattern) * @cw
      end
      sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
      self.src_rect.set(sx, sy, @cw, @ch)
    end
  end
end
 | 
 |