Project1

标题: 请问如何显示图片 [打印本页]

作者: j296196585    时间: 2017-6-20 00:22
标题: 请问如何显示图片
小肉包 大人  那个帖子不能在发问题了

RUBY 代码复制
  1. draw_actor_face
  2. 这个是显示图片用的
  3. 可是要吗出错
  4. 要吗没反应

RUBY 代码复制
  1. class Scene_FF < Scene_Base
  2.   def start
  3.     super
  4.     c_ff
  5.   end
  6.   def c_ff
  7.     @bl = W_FF.new
  8.     @bl.set_handler(:cancel,    method(:return_scene))
  9.   end
  10. end
  11. class W_FF < Window_Selectable
  12.   def initialize
  13.     super(0,0,544,416)
  14.     refresh
  15.     activate
  16.   end
  17.   def refresh
  18.     contents.clear
  19.     if $game_switches[202]==true
  20.       contents.font.color = Color.new(255, 255, 0, 255)
  21.       draw_text(0, 0, 100, 32,"剑越卄" )
  22.              case  $game_variables[52]
  23.              when 0
  24.              draw_text(88, 0, 126, 32,"一面之缘" )
  25.              when 10
  26.              draw_text(88, 0, 126, 32,"颇有好感" )
  27.  
  28.              when 20
  29.               draw_text(88, 0, 126, 32,"惺惺相惜" )
  30.               when 30
  31.              draw_text(88, 0, 126, 32,"爱慕倾心" )
  32.               when 40
  33.               draw_text(88, 0, 126, 32,"生死与共" )
  34.               end
  35.     end
  36.     if $game_switches[203]==true
  37.       contents.font.color = Color.new(0, 255, 0, 255)
  38.       draw_text(0, 32, 128, 32,"幻羽" )
  39.              case  $game_variables[53]
  40.              when -10
  41.               draw_text(88, 32, 126, 32,"不胜厌恶" )
  42.              when 0
  43.           draw_text(88, 32, 126, 32,"一面之缘" )
  44.              when 10
  45.              draw_text(88, 32, 126, 32,"颇有好感" )
  46.              when 20
  47.               draw_text(88, 32, 126, 32,"惺惺相惜" )
  48.               when 30
  49.             draw_text(88, 32, 126, 32,"爱慕倾心" )
  50.               when 40
  51.              draw_text(88, 32, 126, 32,"生死与共" )
  52.               end
  53.     end
  54.     if $game_switches[202]==false
  55.           draw_text(250, 200, 126, 32,"暂无人物关系" )
  56.         end
  57.       end
  58. end

360截图20170620002002192.jpg (63.11 KB, 下载次数: 14)

请问如何显示图片

请问如何显示图片

作者: 魔法丶小肉包    时间: 2017-6-20 10:04
直接用draw_face吧,draw_face(face_name, face_index, x, y, enabled = true)
也就是说draw_face(图片名, 图片索引, x坐标, y坐标)
素材格式和尺寸请参考默认的脸图素材
如果不想用这种尺寸的话,可以把这个方法复制到W_FF改一改
作者: j296196585    时间: 2017-6-20 14:33
本帖最后由 j296196585 于 2017-6-20 14:35 编辑
魔法丶小肉包 发表于 2017-6-20 10:04
直接用draw_face吧,draw_face(face_name, face_index, x, y, enabled = true)
也就是说draw_face(图片名,  ...


(face_name, face_index, x, y, enabled = true)看不懂
也就是说draw_face(图片名, 图片索引, x坐标, y坐标)图片索引 这什么意思也不懂
            draw_icon(2,126,35,true) #图标  我居然会图标了好难得
           draw_face(1, 1, 126, 36, enabled = true)#头像  不会  不懂 无奈
            draw_face(1, 1, 126, 36)#头像  不会 不懂   怎么办

360截图20170620143452919.jpg (23.74 KB, 下载次数: 12)

360截图20170620143452919.jpg

作者: j296196585    时间: 2017-6-20 22:17
本帖最后由 j296196585 于 2017-6-20 22:22 编辑
魔法丶小肉包 发表于 2017-6-20 10:04
直接用draw_face吧,draw_face(face_name, face_index, x, y, enabled = true)
也就是说draw_face(图片名,  ...


初始脚本
大概就是下图这个样子  不知道行不行
本来一直在做XP游戏 XP脚本也摸索的差不多 只是战斗系统崩溃 就转战VA了

RUBY 代码复制
  1. class Scene_FF < Scene_Base
  2.   def start
  3.     super
  4.     c_ff
  5.   end
  6.   def c_ff
  7.     @bl = W_FF.new
  8.     @bl.set_handler(:cancel,    method(:return_scene))
  9.   end
  10. end
  11. class W_FF < Window_Selectable
  12.   def initialize
  13.     super(0,0,544,416)
  14.     refresh
  15.     activate
  16.   end
  17.   def refresh
  18.     contents.clear
  19.     if $game_switches[202]==true
  20.       contents.font.color = Color.new(0, 255, 0, 255)
  21.       draw_text(0, 0, 128, 32,"剑越卄" )
  22.              case  $game_variables[52]
  23.              when 0
  24.              draw_text(88, 0, 126, 32,"一面之缘" )
  25.              when 10
  26.              draw_text(88, 0, 126, 32,"颇有好感" )
  27.              when 20
  28.               draw_text(88, 0, 126, 32,"惺惺相惜" )
  29.               when 30
  30.              draw_text(88, 0, 126, 32,"爱慕倾心" )
  31.               when 40
  32.               draw_text(88, 0, 126, 32,"生死与共" )
  33.               end
  34.     end
  35.     if $game_switches[203]==true
  36.       contents.font.color = Color.new(0, 255, 0, 255)
  37.       draw_text(0, 32, 128, 32,"幻羽" )
  38.              case  $game_variables[53]
  39.              when -10
  40.               draw_text(88, 32, 126, 32,"不胜厌恶" )
  41.              when 0
  42.           draw_text(88, 32, 126, 32,"一面之缘" )
  43.              when 10
  44.              draw_text(88, 32, 126, 32,"颇有好感" )
  45.              when 20
  46.               draw_text(88, 32, 126, 32,"惺惺相惜" )
  47.               when 30
  48.             draw_text(88, 32, 126, 32,"爱慕倾心" )
  49.               when 40
  50.              draw_text(88, 32, 126, 32,"生死与共" )
  51.               end
  52.     end
  53.     if $game_switches[202]==false
  54.           draw_text(250, 200, 126, 32,"暂无人物关系" )
  55.         end
  56.       end
  57. end

天下第一.png (155.33 KB, 下载次数: 3)

天下第一.png

主角_看图王.png (24.8 KB, 下载次数: 6)

主角_看图王.png

作者: 魔法丶小肉包    时间: 2017-6-20 23:16
像这样吗?

  1. class Scene_FF < Scene_Base
  2.   def start
  3.     super
  4.     c_ff
  5.   end
  6.   def c_ff
  7.     @bl = W_FF.new
  8.     @bl.set_handler(:cancel,    method(:return_scene))
  9.   end
  10. end
  11. class W_FF < Window_Selectable
  12.   def initialize
  13.     super(0,0,544,416)
  14.     refresh
  15.     activate
  16.   end
  17.   def refresh
  18.     contents.clear
  19.     if $game_switches[202]==true
  20.       contents.font.color = Color.new(0, 255, 0, 255)
  21.       draw_text(100, 0, 128, 32,"剑越卄" )
  22.       draw_face("主角", 0, 0, 0)
  23.              case  $game_variables[52]
  24.              when 0
  25.              draw_text(188, 0, 126, 32,"一面之缘" )
  26.              when 10
  27.              draw_text(188, 0, 126, 32,"颇有好感" )
  28.              when 20
  29.               draw_text(188, 0, 126, 32,"惺惺相惜" )
  30.               when 30
  31.              draw_text(188, 0, 126, 32,"爱慕倾心" )
  32.               when 40
  33.               draw_text(188, 0, 126, 32,"生死与共" )
  34.               end
  35.     end
  36.     if $game_switches[203]==true
  37.       contents.font.color = Color.new(0, 255, 0, 255)
  38.       draw_text(0, 32, 128, 32,"幻羽" )
  39.              case  $game_variables[53]
  40.              when -10
  41.               draw_text(88, 32, 126, 32,"不胜厌恶" )
  42.              when 0
  43.           draw_text(88, 32, 126, 32,"一面之缘" )
  44.              when 10
  45.              draw_text(88, 32, 126, 32,"颇有好感" )
  46.              when 20
  47.               draw_text(88, 32, 126, 32,"惺惺相惜" )
  48.               when 30
  49.             draw_text(88, 32, 126, 32,"爱慕倾心" )
  50.               when 40
  51.              draw_text(88, 32, 126, 32,"生死与共" )
  52.               end
  53.     end
  54.     if $game_switches[202]==false
  55.           draw_text(250, 200, 126, 32,"暂无人物关系" )
  56.         end
  57.       end
  58.   def draw_face(face_name, face_index, x, y, enabled = true)
  59.     bitmap = Cache.face(face_name)
  60.     rect = Rect.new(face_index % 4 * 96, face_index * 96, 96, 96)
  61.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  62.     bitmap.dispose
  63.   end
  64. end
复制代码








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