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

Project1

 找回密码
 注册会员
搜索

如何判断角色存在?

查看数: 1773 | 评论数: 5 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2013-10-13 15:12

正文摘要:

RUBY 代码复制#----------------------------------------------------------------------------  # * 更新内容  #---------------------------------------------- ...

回复

zhangfuzhou 发表于 2013-10-13 15:56:12
喵呜喵5 发表于 2013-10-13 15:49
出错那一句改成刚才漏打了一个点……

十分感谢,已成功

点评

啊啊啊啊啊~我爱你啊~用大红字表达下感情~  发表于 2013-10-13 19:04
喵呜喵5 发表于 2013-10-13 15:49:08
本帖最后由 喵呜喵5 于 2013-10-13 15:51 编辑
zhangfuzhou 发表于 2013-10-13 15:44
请看上一楼,忘点回复了,回复成自己了


出错那一句改成
  1. ($game_party.members.size - 1).times do |i|
复制代码
刚才漏打了一个点……

评分

参与人数 1梦石 +1 收起 理由
熊喵酱 + 1 认可答案

查看全部评分

zhangfuzhou 发表于 2013-10-13 15:44:29
喵呜喵5 发表于 2013-10-13 15:33
第一段代码换成这种感觉?(字体大小修改、颜色修改什么的都删掉了,可行的话之后你自己补回去吧……) ...

请看上一楼,忘点回复了,回复成自己了
zhangfuzhou 发表于 2013-10-13 15:42:37
我是个整体的窗口,就一个,在左侧
  1. class Window_MapStatus < Window_Base
  2.   #----------------------------------------------------------------------------
  3.   # * 初始化
  4.   #----------------------------------------------------------------------------
  5.   def initialize
  6.     super(0, 0, 271, 426)
  7.     self.opacity = 255
  8.     refresh
  9.   end
复制代码
你这段脚本提示
  1.     ($game_party.members.size - 1) times do |i|
复制代码
出错,我把整个脚本给你看吧
  1. #==============================================================================
  2. # ** Window_MapStatus
  3. #==============================================================================
  4. class Window_MapStatus < Window_Base
  5.   #----------------------------------------------------------------------------
  6.   # * 初始化
  7.   #----------------------------------------------------------------------------
  8.   def initialize
  9.     super(0, 0, 271, 426)
  10.     self.opacity = 0
  11.     refresh
  12.   end
  13.   #----------------------------------------------------------------------------
  14.   # * 刷新画面
  15.   #----------------------------------------------------------------------------
  16.   def update
  17.     super
  18.     refresh if $refresh
  19.     $refresh = false
  20.     if $game_player.screen_x >= 0 and $game_player.screen_x <= self.width and
  21.        $game_player.screen_y >= 0 and $game_player.screen_y <= self.height
  22.       self.contents_opacity = 60
  23.     else self.contents_opacity = 255
  24.     end
  25.   end
  26.   #----------------------------------------------------------------------------
  27.   # * 更新内容
  28.   #----------------------------------------------------------------------------
  29.   def refresh
  30.     self.contents.clear
  31.     self.contents.font.size = 22
  32.     self.contents.font.bold = true
  33.     draw_actor_name($game_party.members[0], 0, 0)
  34.     self.contents.font.size = 18
  35.     self.contents.font.color = Color.new(64, 224, 208)
  36.     self.contents.draw_text(60, 350, self.contents.width - 40, 24, $game_party.members[1].level)
  37.     self.contents.draw_text(143, 350, self.contents.width - 40, 24, $game_party.members[2].level)
  38.     self.contents.draw_text(226, 350, self.contents.width - 40, 24, $game_party.members[3].level)
  39.     self.contents.font.color = Color.new(51, 161, 201)
  40.     self.contents.draw_text(80, 0, 42, 24, "Lv.")
  41.     self.contents.font.color = text_color(0)
  42.     self.contents.draw_text(110, 0, self.contents.width - 40, 24, $game_party.members[0].level)
  43.     draw_actor_icons($game_party.members[0], 0, 86,264)
  44.     draw_actor_icons($game_party.members[1], 0, 328,72)
  45.     draw_actor_icons($game_party.members[2], 83, 328,72)
  46.     draw_actor_icons($game_party.members[3], 166, 328,72)
  47.     draw_actor_hp($game_party.members[0], 0, 20, self.contents.width - 110)
  48.     draw_actor_mp($game_party.members[0], 0, 40, self.contents.width - 110)
  49.     draw_actor_exp($game_party.members[0], 0, 60, self.contents.width - 110)
  50.     self.contents.font.size = 14
  51.     draw_actor_name($game_party.members[1], 0, 350)
  52.     draw_actor_hp($game_party.members[1], 0, 363, self.contents.width - 167)
  53.     draw_actor_mp($game_party.members[1], 0, 378, self.contents.width - 167)
  54.     draw_actor_name($game_party.members[2], 83, 350)
  55.     draw_actor_hp($game_party.members[2], 83, 363, self.contents.width - 167)
  56.     draw_actor_mp($game_party.members[2], 83, 378, self.contents.width - 167)
  57.     draw_actor_name($game_party.members[3], 166, 350)
  58.     draw_actor_hp($game_party.members[3], 166, 363, self.contents.width - 167)
  59.     draw_actor_mp($game_party.members[3], 166, 378, self.contents.width - 167)
  60.     self.contents.font.bold = false
  61.   end
  62.   #----------------------------------------------------------------------------
  63.   # * 描绘EXP槽
  64.   #----------------------------------------------------------------------------
  65.   def draw_actor_exp(actor, x, y, width=124)
  66.     rate = actor.exp.to_f / actor.next_level_exp.to_f
  67.     draw_gauge(x, y, width, rate, Color.new(0, 255, 0), Color.new(100, 255, 100))
  68.     self.contents.font.color = text_color(16)
  69.     self.contents.draw_text(x, y, 56, 24, "EXP")
  70.     self.contents.font.color = Color.new(255, 255, 255)
  71.     en = "#{actor.exp}/#{actor.next_level_exp}"
  72.     self.contents.draw_text(x, y, width, 24, en, 2)
  73.   end
  74.   #----------------------------------------------------------------------------
  75.   # * 描绘值槽
  76.   #----------------------------------------------------------------------------
  77.   def draw_gauge(x, y, width, rate, color1, color2)
  78.     fill_w = (width * rate).to_i
  79.     self.contents.gradient_fill_rect(x, y+12, fill_w, 6, color1, color2, true)
  80.     self.contents.gradient_fill_rect(x, y+18, fill_w, 6, color2, color1, true)
  81.     self.contents.fill_rect(x, y+12, width, 2, Color.new(94, 38, 18))
  82.     self.contents.fill_rect(x, y+22, width, 2, Color.new(94, 38, 18))
  83.     self.contents.fill_rect(x, y+14, 2, 8, Color.new(94, 38, 18))
  84.     self.contents.fill_rect(x+width-2, y+14, 2, 8, Color.new(94, 38, 18))
  85.   end
  86.   #----------------------------------------------------------------------------
  87.   # * 描绘名称
  88.   #----------------------------------------------------------------------------
  89.   def draw_actor_name(actor, x, y, width = 112)
  90.     color = Color.new(252, 230, 201)
  91.     color = crisis_color if actor.hp < actor.mhp /
  92.     color = knockout_color if actor.hp == 0
  93.     change_color(color)
  94.     draw_text(x, y, width, line_height, actor.name)
  95.   end
  96. end
复制代码
喵呜喵5 发表于 2013-10-13 15:33:02
  1. #----------------------------------------------------------------------------
  2.   # * 更新内容
  3.   #----------------------------------------------------------------------------
  4.   def refresh
  5.    
  6.     self.contents.clear
  7.     self.contents.font.size = 22
  8.     self.contents.font.bold = true
  9.    
  10.     #绘制左上角的内容
  11.     draw_actor_name($game_party.members[0], 0, 0)   
  12.     self.contents.draw_text(110, 0, self.contents.width - 40, 24, $game_party.members[0].level)     
  13.     self.contents.draw_text(80, 0, 42, 24, "Lv.")
  14.     draw_actor_icons($game_party.members[0], 0, 86,264)
  15.     draw_actor_hp($game_party.members[0], 0, 20, self.contents.width - 110)
  16.     draw_actor_mp($game_party.members[0], 0, 40, self.contents.width - 110)
  17.     draw_actor_exp($game_party.members[0], 0, 60, self.contents.width - 110)

  18.     #绘制左下角的内容   
  19.     ($game_party.members.size - 1) times do |i|
  20.       self.contents.draw_text(60+83*i, 350, self.contents.width - 40, 24, $game_party.members[i+1].level)
  21.       draw_actor_icons($game_party.members[i+1], 83*i, 328,72)
  22.       draw_actor_name($game_party.members[i+1], 83*i, 350)
  23.       draw_actor_hp($game_party.members[i+1], 83*i, 363, self.contents.width - 167)
  24.       draw_actor_mp($game_party.members[i+1], 83*i, 378, self.contents.width - 167)
  25.     end
  26.    
  27.   end
复制代码
第一段代码换成这种感觉?(字体大小修改、颜色修改什么的都删掉了,可行的话之后你自己补回去吧……)
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2025-5-26 02:39

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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