Project1

标题: 战斗中图片显示的问题 [打印本页]

作者: redant    时间: 2008-5-9 02:27
标题: 战斗中图片显示的问题

  1. #==============================================================================
  2. # ■ Window_BattleStatus
  3. #------------------------------------------------------------------------------
  4. #  显示战斗画面同伴状态的窗口。
  5. #==============================================================================

  6. class Window_BattleStatus < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize#下面战斗中人物的血法之类
  11.     super(0, 0, 640, 480)
  12.     self.contents = Bitmap.new(width , height )
  13.     self.z = 1 #小改动
  14.     self.back_opacity = 0 #小改动
  15.     @level_up_flags = [false, false, false, false]
  16.     refresh
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 释放
  20.   #--------------------------------------------------------------------------
  21.   def dispose
  22.     super
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 设置升级标志
  26.   #     actor_index : 角色索引
  27.   #--------------------------------------------------------------------------
  28.   def level_up(actor_index)
  29.     @level_up_flags[actor_index] = true
  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # ● 刷新
  33.   #--------------------------------------------------------------------------
  34.   def refresh
  35.     self.contents.clear
  36.     bitmap=Bitmap.new("Graphics/Pictures/2_战斗图.png")
  37.     src_rect= Rect.new(0,0,bitmap.width,bitmap.height)
  38.     self.contents.blt(22,360,bitmap,src_rect)
  39.     @item_max = $game_party.actors.size
  40.     for i in 0...$game_party.actors.size
  41.       actor = $game_party.actors[i]
  42.       actor_x = i * 160 + 145
  43.       #draw_actor_name(actor, actor_x, 0)
  44.       hp(actor,actor_x,400)
  45.       if @level_up_flags[i]
  46.         self.contents.font.color = normal_color
  47.         self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
  48.       else
  49.         draw_actor_state(actor, actor_x, 96)
  50.       end
  51.     end
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● 刷新画面
  55.   #--------------------------------------------------------------------------
  56.   def update
  57.     super
  58.     # 主界面的不透明度下降
  59.     if $game_temp.battle_main_phase
  60.       self.contents_opacity -= 4 if self.contents_opacity > 191
  61.     else
  62.       self.contents_opacity += 4 if self.contents_opacity < 255
  63.     end
  64.   end
  65. end
复制代码

也就是 第37行 bitmap=Bitmap.new("Graphics/Pictures/2_战斗图.png")
我想要把 2_战斗图 改成 角色名字_战斗图  (角色ID 也行)
具体怎么弄  我试过几次 可总是出现错误……
作者: cZooCz    时间: 2008-5-9 02:32
name = actor.name
bitmap=Bitmap.new("Graphics/Pictures/#{name}.png")

作者: 3535    时间: 2008-5-9 02:33
bitmap=Bitmap.new("Graphics/Pictures/#{$game_actors[1].name}_战斗图.png")
作者: redant    时间: 2008-5-9 02:36

是这个问题  怎么解决呢?
作者: Infrared    时间: 2008-5-9 02:37
提示: 作者被禁止或删除 内容自动屏蔽
作者: redant    时间: 2008-5-9 02:39
恩 试了 好像只显示一个 图 我有2个人物 想 分别显示
有可能是盖住了  我调下
作者: cZooCz    时间: 2008-5-9 02:41
那是当然的,修改成
bitmap=Bitmap.new("Graphics/Pictures/#{$game_actors.name}.png")
作者: redant    时间: 2008-5-9 02:43

作者: Infrared    时间: 2008-5-9 02:49
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1