secondsen 发表于 2009-2-25 11:28:00

根据在线纸娃娃做了一个纸娃娃换装系统,RMVX半成品


####################################################
# Game_Character 中在定义实例变量中添加
attr_accessor :switch                   # 开关
attr_accessor :gender                   # 性别
attr_accessor :acce1                  # acce1 ID
attr_accessor :acce2                  # acce2 ID
attr_accessor :body                     # body ID
attr_accessor :hair                     # hair ID
attr_accessor :hairop                   # hairop ID
attr_accessor :mante                  # manta ID
attr_accessor :option                   # option ID
####################################################




# Game_Character 中在定义实例变量中添加
    ###############################
    # 初始化中添加
    @switch = false
    @gender = "ym" # ym 为男性
    @acce1 = ""
    @acce2 = ""
    @body = ""
    @hair = ""
    @hairop = ""
    @mante = ""
    @option = ""
    ###############################



Game_event    (事件也要换装。。。所以要改)

Game_Event的初始化里添加


    #############################
    temp = @event.name.split('@')
    @switch = eval(temp)
    @gender = temp # ym 为男性
    @acce1 = temp
    @acce2 = temp
    @body = temp
    @hair = temp
    @hairop = temp
    @mante = temp
    @option = temp
    temp.clear
    temp = nil
    #############################




Sprite_Character是图片。。。不能错过
初始化里加这些。。。。一定要在update的前一句加,不要改变地方

    ########################################################
    @c = Bitmap.new(96,128)
    if character.switch
      path = "character/image/" + character.gender + "/"
      if character.option != ""
      p = path + "option/back_" + character.gender + "/" + character.option + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
      if character.acce1 != ""
      p = path + "acce1/back_" + character.gender + "/" + character.acce1 + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
      if character.hairop != ""
      p = path + "hairop/back_" + character.gender + "/" + character.hairop + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
      if character.hair != ""
      p = path + "hair/back_" + character.gender + "/" + character.hair + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
      if character.mante != ""
      p = path + "mante/back_" + character.gender + "/" + character.mante + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
      if character.acce2 != ""
      p = path + "acce2/back_" + character.gender + "/" + character.acce2 + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
      if character.body != ""
      p = path + "body/" + character.body + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      else
          p = path + "body.png"
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      else
      p = path + "body.png"
      temp = Bitmap.new(p)
      @c.blt(0,0,temp,Rect.new(0,0,96,128))
      temp.dispose
      end
      if character.hair != ""
      p = path + "hair/front_" + character.gender + "/" + character.hair + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      else
          p = path + "hair.png"
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      else
      p = path + "hair.png"
      temp = Bitmap.new(p)
      @c.blt(0,0,temp,Rect.new(0,0,96,128))
      temp.dispose
      end
      if character.acce2 != ""
      p = path + "acce2/middle_" + character.gender + "/" + character.acce2 + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
      if character.mante != ""
      p = path + "mante/front_" + character.gender + "/" + character.mante + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
      if character.acce1 != ""
      p = path + "acce1/front_" + character.gender + "/" + character.acce1 + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
      if character.hair != ""
      p = path + "hair/top_" + character.gender + "/" + character.hair + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
      if character.acce2 != ""
      p = path + "acce2/front_" + character.gender + "/" + character.acce2 + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
      if character.hairop != ""
      p = path + "hairop/front_" + character.gender + "/" + character.hairop + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
      if character.acce1 != ""
      p = path + "acce1/top_" + character.gender + "/" + character.acce1 + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
      if character.option != ""
      p = path + "option/front_" + character.gender + "/" + character.option + ".png"
      if File.exist?(p)
          temp = Bitmap.new(p)
          @c.blt(0,0,temp,Rect.new(0,0,96,128))
          temp.dispose
      end
      end
    end
    #########################################################################

找到这个地方
#--------------------------------------------------------------------------
# ● 更新传送源的位图
#--------------------------------------------------------------------------
def update_bitmap

将下边的东西搞掉。。。。

          self.bitmap = Cache.character(@character_name)
          sign = @character_name[/^[\!\$]./]
          if sign != nil and sign.include?('$')
            @cw = bitmap.width / 3
            @ch = bitmap.height / 4
          else
            @cw = bitmap.width / 12
            @ch = bitmap.height / 8
          end

替换成


      #############################################
      if @character.switch
          self.bitmap = @c
          @cw = bitmap.width / 3
          @ch = bitmap.height / 4
      #############################################
      else
          self.bitmap = Cache.character(@character_name)
          sign = @character_name[/^[\!\$]./]
          if sign != nil and sign.include?('$')
            @cw = bitmap.width / 3
            @ch = bitmap.height / 4
          else
            @cw = bitmap.width / 12
            @ch = bitmap.height / 8
          end
      end


#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
中添加一个释放的东西
一定要在super前面加


@c.dispose


完毕。。。

范例的说明:

ymym1 两个压缩包解开之后放入工程那个包里
character/image/ym文件夹中

secondsen 发表于 2009-2-25 11:30:25

下面该说明了:

1.这个东西,素材存放的位置是根据在线纸娃娃弄的。。。。有心的搞一下就知道了

2.在线纸娃娃我不提供。。。去自己的缓存里揪出来

3.这是半成品,不能换装,只能拼。。。。

完毕。。。待成品出来我把东西都传上来



这个txt是我打开网页后点“查看”->“源文件”得到的

图片的优先级,下载路径一目了然

另外,去缓存里复制出来更快。。。。。。而且能知道图片是存在什么文件里的。。。。。。我就是这样一个一个点然后复制出来的

secondsen 发表于 2009-2-25 13:37:28

使用方法:(刚才竟然忘记了)

把事件的名字改了就可以

格式:
事件名@开关(true/false)@性别("ym"/"yw")(ym男yw女)@acce1@acce2@body@hair@hairop@mante@option

完毕,后边英文的都是图片名到对应的文件夹找acce1 就在 acce1 这个文件夹以此类推

dnfnb 发表于 2010-2-1 23:24:02

不错 马克~

samhming 发表于 2010-10-11 22:34:51

請問..大大~我事件無法開啟~可以教一下嗎~"~
页: [1]
查看完整版本: 根据在线纸娃娃做了一个纸娃娃换装系统,RMVX半成品