设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索

请问如何显示图片

查看数: 3019 | 评论数: 4 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2017-6-20 00:22

正文摘要:

小肉包 大人  那个帖子不能在发问题了 RUBY 代码复制draw_actor_face这个是显示图片用的 可是要吗出错要吗没反应draw_actor_face 这个是显示图片用的 可是要吗出错 要吗没反应 ...

回复

魔法丶小肉包 发表于 2017-6-20 23:16:25
像这样吗?

  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
复制代码



点评

这么快 谢谢 非常好  发表于 2017-6-20 23:33

评分

参与人数 1梦石 +1 收起 理由
VIPArcher + 1 清陈年老帖 认可答案

查看全部评分

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

点评

谢谢马上测试 效果  发表于 2017-6-20 14:07

评分

参与人数 1星屑 +40 收起 理由
j296196585 + 40

查看全部评分

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-7-22 10:56

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表