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

Project1

 找回密码
 注册会员
搜索
查看: 2331|回复: 1
打印 上一主题 下一主题

[已经过期] 修改分辨率后,血条无法显示

[复制链接]

Lv1.梦旅人

梦石
0
星屑
110
在线时间
85 小时
注册时间
2010-8-19
帖子
137
跳转到指定楼层
1
发表于 2012-6-3 20:42:25 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式
我用了修改分辨率的脚本以后,血条怎么都显示不了了,应该怎么改呢 我分辨率是800*600的
  1. #==============================================================================
  2. # ■ Scene_Map
  3. #------------------------------------------------------------------------------
  4. #  处理地图画面的类。
  5. #==============================================================================
  6. class Scene_Map
  7.   #--------------------------------------------------------------------------
  8.   # ● 在这里控制脚本的属性
  9.   #--------------------------------------------------------------------------
  10.   SWITCH_ID = 1 #在这里设定开关的编号……
  11.   $center_hud = true #这里决定是否将HUD(状态窗口)居中显示……
  12.   #--------------------------------------------------------------------------
  13.   # ● 初始化别名
  14.   #--------------------------------------------------------------------------
  15.   alias raz_hud_main main
  16.   alias raz_hud_update update
  17.   #--------------------------------------------------------------------------
  18.   # ● 主进程
  19.   #--------------------------------------------------------------------------  
  20.   def main
  21.     @size = $game_party.actors.size
  22.     raz_hud_main
  23.     @hud_window.dispose
  24.     for i in 0...$game_party.actors.size
  25.       @hud_dummy[i].dispose
  26.     end #for
  27.   end #def
  28.   #--------------------------------------------------------------------------
  29.   # ● 刷新画面
  30.   #--------------------------------------------------------------------------  
  31.   def update
  32.     if @size != $game_party.actors.size
  33.       @hud_window.refresh
  34.       show_window
  35.     end #if
  36.     if @hud != true
  37.       main_window
  38.     end #if
  39.     turn_hud_on_off
  40.     @hud_window.update
  41.     raz_hud_update
  42.   end #def
  43.   #--------------------------------------------------------------------------
  44.   # ● 与状态窗口的显示行为相关的语句
  45.   #--------------------------------------------------------------------------   
  46.   def show_window
  47.     @size = $game_party.actors.size
  48.     for i in 0..3
  49.       @hud_dummy[i].visible = ($game_party.actors[i] != nil)
  50.     end #for
  51.   end #def
  52.   #--------------------------------------------------------------------------
  53.   # ● 与状态窗口的创建相关的语句
  54.   #--------------------------------------------------------------------------     
  55.   def main_window
  56.     @opacity = 0
  57.     @hud_dummy = []
  58.     for i in 0...4
  59.       y = $game_party.actors.size - 1
  60.       x = 240 - (y * 80)# 240 - (y * 80)
  61.       if $center_hud == true
  62.         @hud_dummy[i] = Window_Base.new(160 * i + x, 372,160, 108)#@hud_dummy[i] = Window_Base.new(160 * i + x, 372,160, 108)
  63.       else
  64.         @hud_dummy[i] = Window_Base.new(160 * i, 372,160, 108)#@hud_dummy[i] = Window_Base.new(160 * i, 372,160, 108)
  65.       end #if
  66.       @hud_dummy[i].opacity = @opacity
  67.       @hud_dummy[i].visible = false
  68.     end #for
  69.     @hud_window = Window_HUD.new
  70.     for i in 0...$game_party.actors.size
  71.       @hud_dummy[i].visible = $game_party.actors[i] != nil
  72.     end #for
  73.     @hud = true
  74.   end #def
  75.   #--------------------------------------------------------------------------
  76.   # ● 与状态窗口的开关相关的语句
  77.   #--------------------------------------------------------------------------   
  78.   def turn_hud_on_off
  79.    if $game_switches[SWITCH_ID] == false #关掉开关
  80.     @hud_window.visible = false
  81.       for i in 0...$game_party.actors.size
  82.         @hud_dummy[i].visible = false
  83.       end #for
  84.     end #if
  85.    if $game_switches[SWITCH_ID] == true #打开开关
  86.      @hud_window.visible = true
  87.      for i in 0...$game_party.actors.size
  88.        @hud_dummy[i].visible = true
  89.      end #for
  90.    end #if
  91.   end #def
  92. end #class
  93. #==============================================================================
  94. # ■ Window_HUD
  95. #------------------------------------------------------------------------------
  96. #  地图画面中显示的状态窗口。
  97. #==============================================================================
  98. class Window_HUD < Window_Base
  99.   #--------------------------------------------------------------------------
  100.   # ● 初始化对象
  101.   #--------------------------------------------------------------------------
  102.   def initialize
  103.     super(300, 500, 800, 600) #(0, 0, 800, 600) -370
  104.    # self.contents = Bitmap.new(width - 32, height - 32)
  105.     self.opacity = 0
  106.     self.back_opacity = 150
  107.     for i in 0...$game_party.actors.size
  108.       actor = $game_party.actors[i]
  109.       eval("@old_hp#{i+1} = actor.hp; @old_sp#{i+1} = actor.sp; @old_exp#{i+1} = actor.now_exp")
  110.     end #for
  111.     refresh
  112.   end #def
  113.   #--------------------------------------------------------------------------
  114.   # ● 刷新
  115.   #--------------------------------------------------------------------------
  116.   def refresh
  117.     self.contents.clear
  118.     for i in 0...$game_party.actors.size
  119.       a = $game_party.actors.size - 1
  120.       actor = $game_party.actors[i]
  121.       if $center_hud == true
  122.        x = (i * 160 + 25) + (240 - (a * 80))#(i * 160 + 25) + (240 - (a * 80))
  123.       else
  124.        x = i * 160 + 25#x = i * 160 + 25
  125.       end #if
  126.       self.contents.font.size = 21
  127.       draw_actor_graphic(actor, x - 15, 445)
  128.       self.contents.font.color = normal_color
  129.       self.contents.draw_text(x, 360, 100, 32, actor.name)
  130.       width = 200
  131.       height = 6
  132.       draw_slant_bar(x + 8, 396, actor.hp, actor.maxhp, width, height, Color.new(150, 0, 0), Color.new(155, 155, 60))
  133.       draw_slant_bar(x + 8, 416, actor.sp, actor.maxsp, width, height, Color.new(0, 0, 150), Color.new(60, 155, 155))
  134.       unless actor.level == 99
  135.         draw_slant_bar(x + 8, 436, actor.now_exp, actor.next_exp, width, height, Color.new(0, 150, 0), Color.new(60, 255, 60))
  136.       else
  137.         draw_slant_bar(x + 8, 436, 1, 1, width = 200, height = 6, Color.new(0, 150, 0), Color.new(60, 255, 60))
  138.       end #unless
  139.       self.contents.font.size = 16
  140.       draw_actor_state(actor, x + 125, 360)
  141.       self.contents.font.color = normal_color
  142.       self.contents.font.bold = true
  143.       self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  144.       self.contents.draw_text(x + 60, 382, 100, 32, "#{actor.hp}/#{actor.maxhp}", 1)
  145.       self.contents.font.color = actor.sp == 0 ? crisis_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  146.       self.contents.draw_text(x + 60, 402, 100, 32, "#{actor.sp}/#{actor.maxsp}", 1)
  147.       self.contents.draw_text(x + 25, 422, 100, 32, "#{(actor.now_exp.to_f / actor.next_exp.to_f * 100).truncate}"+"%", 1)
  148.       self.contents.font.color = system_color
  149.       self.contents.font.size = 20
  150.       self.contents.font.bold = false
  151.       self.contents.draw_text(x, 384, 50, 32, "精") #HP的显示文本,可修改。
  152.       self.contents.draw_text(x, 404, 50, 32, "神") #SP的显示文本,可修改。
  153.       self.contents.draw_text(x, 424, 50, 32, "经") #EXP的显示文本,可修改。
  154.       
  155.     end #for
  156.   end #def
  157.   #--------------------------------------------------------------------------
  158.   # ● 刷新画面
  159.   #--------------------------------------------------------------------------
  160.   def update
  161.     super
  162.     for i in 0...$game_party.actors.size
  163.       actor = $game_party.actors[i]
  164.       if (eval("@old_hp#{i+1}") != actor.hp or eval("@old_sp#{i+1}") != actor.sp or
  165.         eval("@old_exp#{i+1}") != actor.now_exp)
  166.         refresh
  167.         eval("@old_hp#{i+1} = actor.hp; @old_sp#{i+1} = actor.sp; @old_exp#{i+1} = actor.now_exp")
  168.       end #if
  169.     end #super
  170.   end #def
  171. end #class
  172. #==============================================================================
  173. # ■ Window_Base
  174. #------------------------------------------------------------------------------
  175. #  游戏中全部窗口的超级类。
  176. #==============================================================================
  177. class Window_Base < Window
  178.   #状态条的绘制
  179.   def draw_slant_bar(x, y, min, max, width = 152, height = 6,
  180.       bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
  181.     for i in 0..height
  182.       self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
  183.     end #for
  184.     for i in 1..(height - 1)
  185.       r = 100 * (height - i) / height + 0 * i / height
  186.       g = 100 * (height - i) / height + 0 * i / height
  187.       b = 100 * (height - i) / height + 0 * i / height
  188.       a = 255 * (height - i) / height + 255 * i / height
  189.       self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
  190.     end #for
  191.     for i in 1..( (min / max.to_f) * width - 1)
  192.       for j in 1..(height - 1)
  193.         r = bar_color.red * (width - i) / width + end_color.red * i / width
  194.         g = bar_color.green * (width - i) / width + end_color.green * i / width
  195.         b = bar_color.blue * (width - i) / width + end_color.blue * i / width
  196.         a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
  197.         self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
  198.       end #for
  199.     end #for
  200.   end #def
  201. end #class
  202. #==============================================================================
  203. # ■ Game_Actor
  204. #------------------------------------------------------------------------------
  205. #  处理角色的类。本类在 Game_Actors 类 ($game_actors)
  206. # 的内部使用、Game_Party 类请参考 ($game_party) 。
  207. #==============================================================================
  208. class Game_Actor
  209.   #获取当前EXP
  210.   def now_exp
  211.     return @exp - @exp_list[@level]
  212.   end #def
  213.   #获取下一级需要EXP的数值
  214.   def next_exp
  215.     return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  216.   end #def
  217. end
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-5-13 19:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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