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

Project1

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

[已经过期] 关于血量显示的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
450
在线时间
16 小时
注册时间
2012-12-8
帖子
4
跳转到指定楼层
1
发表于 2012-12-14 00:19:20 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
找到了一个脚本,但我不想要HP 和SP 血量条的动画效果,就是会闪耀的效果
本人新手,所以看不懂代码.求求修改.教我也可以.
  1. #_______________________________________________________________________________
  2. # MOG - Active Hud 1.2      
  3. #_______________________________________________________________________________
  4. # By Moghunter
  5. # http://www.atelier-rgss.com
  6. #_______________________________________________________________________________
  7. # - 在地图显示角色的各种信息
  8. #   显示图像:(HP,SP,头像,Exp,level)
  9. #
  10. # 所需文件:
  11. #
  12. # Hud_Exp_Meter.png
  13. # Hud_Exp_Number.png
  14. # Hud_Face.png
  15. # Hud_HP_Meter.png
  16. # Hud_HP_Number.png
  17. # Hud_Layout.png
  18. # Hud_SP_Meter.png
  19. # Hud_SP_Number.png
  20. #
  21. # 文件存放在Windowskins文件夹下
  22. #
  23. # 动画(角色的表情变化)
  24. #   显示图像变化需要一个名为" Hud_Face.png "的文件。
  25. #   表情变化有5种类型,如下所示:
  26. #   1 - 正常 2 - 微笑 3 - 悲伤 4 - 怒 5 - 疲劳
  27. #
  28. # MEDIDORES ANIMADOS
  29. #
  30. #_______________________________________________________________________________
  31. # UPDATE
  32. # 1.1 - 使用SP相关
  33. # 1.2 - 添加淡入淡出效果。
  34. #_______________________________________________________________________________
  35. module MOG
  36.   # HUD坐标
  37.   HUD_X = 0
  38.   HUD_Y = 400
  39.   # HP 条形图像坐标
  40.   HP_METER_X = 73
  41.   HP_METER_Y = 42   
  42.   # HP 文字图像坐标
  43.   HP_NUMBER_X = 95
  44.   HP_NUMBER_Y = 30  
  45.   # SP 条形图像坐标
  46.   SP_METER_X = 33
  47.   SP_METER_Y = 64  
  48.   # SP 文字图像坐标
  49.   SP_NUMBER_X = 55
  50.   SP_NUMBER_Y = 53     
  51.   # EXP 条形图像坐标
  52.   EXP_METER_X = 60
  53.   EXP_METER_Y = 26
  54.   #LV 文字图像的坐标
  55.   EXP_NUMBER_X = 60
  56.   EXP_NUMBER_Y = 5
  57.   #背景图像的坐标
  58.   LAYOUT_X = 5
  59.   LAYOUT_Y = 10
  60.   #头像的坐标
  61.   FACE_X = 5
  62.   FACE_Y = 10
  63.   #状态图标是否显示在角色脚下
  64.   STATES_POS_CHARACTER = false
  65.   #状态图标是否有悬浮效果
  66.   FLOAT_STATES = true
  67.   #状态坐标的坐标
  68.   STATES_X = 150
  69.   STATES_Y = 50
  70.   #HP底下的百分比,影响角色的头像
  71.   LOWHP = 30
  72.   #HUD 界面的开关号
  73.   DISABLE_HUD_SWITCH = 5
  74.   #角色接触HUD时是否有半透明效果
  75.   HUD_FADE = true
  76.   #半透明效果的传感器
  77.   HUD_SIZE_X = 180
  78.   HUD_SIZE_Y = 100
  79. end
  80. #==============================================================================
  81. # Game_Actor
  82. #==============================================================================
  83. class Game_Actor < Game_Battler
  84.   
  85. #--------------------------------------------------------------------------
  86. # Now Exp
  87. #--------------------------------------------------------------------------
  88. def now_exp
  89.     return [url=home.php?mod=space&uid=13302]@exp[/url] - @exp_list[@level]
  90. end
  91.   
  92. #--------------------------------------------------------------------------
  93. # Next Exp
  94. #--------------------------------------------------------------------------
  95. def next_exp
  96.     return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  97.     end
  98. end
  99. #==============================================================================
  100. # Game_Temp
  101. #==============================================================================
  102. class Game_Temp
  103.   attr_accessor :hud_face_type
  104.   attr_accessor :hud_face_time
  105.   attr_accessor :hud_face_time2
  106.   attr_accessor :hud_face_refresh
  107.   
  108. #--------------------------------------------------------------------------
  109. # Initialize
  110. #--------------------------------------------------------------------------
  111.   alias active_hud_initialize initialize
  112.   def initialize
  113.     active_hud_initialize
  114.     @hud_face_type = 0
  115.     @hud_face_time = 0
  116.     @hud_face_time2 = 0
  117.     @hud_face_refresh = false
  118.   end   
  119. end
  120. #==============================================================================
  121. # Active_Hud
  122. #==============================================================================
  123. class Active_Hud < Sprite  
  124.   include MOG
  125.   #--------------------------------------------------------------------------
  126.   # * Initialize
  127.   #--------------------------------------------------------------------------
  128.   def initialize(viewport)
  129.     super(viewport)
  130.     [url=home.php?mod=space&uid=95897]@actor[/url] = $game_party.actors[0]
  131.     return if @actor == nil
  132.     @low_sp = LOWHP
  133.     @low_hp = LOWHP
  134.     @hp = @actor.hp
  135.     @sp = @actor.sp
  136.     @exp = @actor.exp
  137.     [url=home.php?mod=space&uid=22147]@level[/url] = @actor.level
  138.     @hp_old = @actor.hp
  139.     @hp_ref = @hp_old
  140.     @hp_refresh = false
  141.     @sp_old = @actor.sp
  142.     @sp_ref = @sp_old
  143.     @sp_refresh = false
  144.     hud_size_x = HUD_SIZE_X
  145.     hud_size_y = HUD_SIZE_Y
  146.     @oc_range_x = hud_size_x + HUD_X
  147.     @oc_range_y = hud_size_y + HUD_Y   
  148.     # Layout -------------------------------------------------------------------
  149.     @layout_image = RPG::Cache.windowskin("Hud_Layout")
  150.     @layout_bitmap = Bitmap.new(@layout_image.width,@layout_image.height)
  151.     @layout_sprite = Sprite.new
  152.     @layout_sprite.bitmap = @layout_bitmap
  153.     @layout_src_rect_back = Rect.new(0, 0,@layout_image.width, @layout_image.height)
  154.     @layout_bitmap.blt(0,0, @layout_image, @layout_src_rect_back)      
  155.     @layout_sprite.z = 5007
  156.     @layout_sprite.x = HUD_X + LAYOUT_X
  157.     @layout_sprite.y = HUD_Y + LAYOUT_Y     
  158.     # Layout -------------------------------------------------------------------
  159.     @face_image = RPG::Cache.windowskin("Hud_Face")
  160.     @face_bitmap = Bitmap.new(@face_image.width,@face_image.height)
  161.     @face_sprite = Sprite.new
  162.     @face_sprite.bitmap = @face_bitmap
  163.     @face_cw = @face_bitmap.width / 5
  164.     @face_ch = @face_bitmap.height
  165.     @face_src_rect_back = Rect.new(@face_cw * $game_temp.hud_face_type, 0,@face_cw , @face_ch)
  166.     @face_bitmap.blt(0,0, @face_image, @face_src_rect_back)      
  167.     @face_sprite.z = 5007
  168.     @face_sprite.x = HUD_X + FACE_X
  169.     @face_sprite.y = HUD_Y + FACE_Y        
  170.     if @actor.hp < @actor.maxhp * @low_hp / 100
  171.        $game_temp.hud_face_type = 4              
  172.     else
  173.        $game_temp.hud_face_type = 0
  174.     end            
  175.     $game_temp.hud_face_time = 10
  176.     # States -------------------------------------------------------------------
  177.     @states_max = 0
  178.     @states = Sprite.new
  179.     @states.bitmap = Bitmap.new(104,24)
  180.     @states_x = @actor.states.size
  181.     @states_y = 0
  182.     @states_f = false
  183.     sta = []
  184.       for i in @actor.states
  185.         unless @states_max > 3
  186.           sta.push($data_states[i].name)
  187.           image = RPG::Cache.icon(sta[@states_max])
  188.           cw = image.width
  189.           ch = image.height
  190.           @states.bitmap.blt(26 * @states_max, 0, image, Rect.new(0, 0, cw, ch))
  191.           @states_max += 1
  192.          end
  193.        end  
  194.     if STATES_POS_CHARACTER == true  
  195.       @states.x = 5 -(13 * @states_x) + $game_player.screen_x
  196.       @states.y = @states_y + $game_player.screen_y
  197.     else
  198.       @states.x = HUD_X + STATES_X
  199.       @states.y = @states_y + HUD_Y + STATES_Y
  200.     end
  201.     @states.z = 5009
  202.     # HP ---------------------------------------------------------------------
  203.     @hp_number_image = RPG::Cache.windowskin("Hud_HP_Number")
  204.     @hp_number_bitmap = Bitmap.new(@hp_number_image.width,@hp_number_image.height)
  205.     @hp_number_sprite = Sprite.new
  206.     @hp_number_sprite.bitmap = @hp_number_bitmap
  207.     @hp_number_sprite.z = 5009
  208.     @hp_number_sprite.x = HUD_X + HP_NUMBER_X
  209.     @hp_number_sprite.y = HUD_Y + HP_NUMBER_Y
  210.     @im_cw = @hp_number_image.width / 10
  211.     @im_ch = @hp_number_image.height / 2   
  212.     @hp_src_rect = Rect.new(@im_cw,0, @im_cw, @im_ch)
  213.     @hp_number_text = @actor.hp.abs.to_s.split(//)
  214.       lowhp2 = @actor.maxhp * 30 / 100
  215.       if @actor.hp < lowhp2
  216.       @health2 = @im_ch
  217.       else
  218.       @health2 = 0
  219.       end
  220.       @hp_health = @health2
  221.       for r in 0..@hp_number_text.size - 1         
  222.          @hp_number_abs = @hp_number_text[r].to_i
  223.          @hp_src_rect = Rect.new(@im_cw * @hp_number_abs, @hp_health, @im_cw, @im_ch)
  224.          @hp_number_bitmap.blt(20 + ((@im_cw - 7) *  r), 0, @hp_number_image, @hp_src_rect)        
  225.       end  
  226.     @hp_flow = 0
  227.     @hp_damage_flow = 0
  228.     @hp_image = RPG::Cache.windowskin("Hud_HP_Meter")
  229.     @hp_bitmap = Bitmap.new(@hp_image.width,@hp_image.height)
  230.     @hp_range = @hp_image.width / 3
  231.     @hp_width = @hp_range  * @actor.hp / @actor.maxhp  
  232.     @hp_height = @hp_image.height / 2
  233.     @hp_width_old = @hp_width
  234.     @hp_src_rect = Rect.new(@hp_range, 0, @hp_width, @hp_height)
  235.     @hp_bitmap.blt(0,0, @hp_image, @hp_src_rect)
  236.     @hp_sprite = Sprite.new
  237.     @hp_sprite.bitmap = @hp_bitmap
  238.     @hp_sprite.z = 5008
  239.     @hp_sprite.x = HUD_X + HP_METER_X
  240.     @hp_sprite.y = HUD_Y + HP_METER_Y
  241.     hp_flow_update
  242.     hp_number_refresh
  243.     # SP ---------------------------------------------------------------------
  244.     @sp_number_image = RPG::Cache.windowskin("Hud_SP_Number")
  245.     @sp_number_bitmap = Bitmap.new(@sp_number_image.width,@sp_number_image.height)
  246.     @sp_number_sprite = Sprite.new
  247.     @sp_number_sprite.bitmap = @sp_number_bitmap
  248.     @sp_number_sprite.z = 5009
  249.     @sp_number_sprite.x = HUD_X + SP_NUMBER_X
  250.     @sp_number_sprite.y = HUD_Y + SP_NUMBER_Y
  251.     @sp_im_cw = @sp_number_image.width / 10
  252.     @sp_im_ch = @sp_number_image.height / 2   
  253.     @sp_src_rect = Rect.new(@sp_im_cw,0, @sp_im_cw, @sp_im_ch)
  254.     @sp_number_text = @actor.sp.abs.to_s.split(//)
  255.     for r in 0..@sp_number_text.size - 1
  256.        @sp_number_abs = @sp_number_text[r].to_i
  257.        @sp_src_rect = Rect.new(@sp_im_cw * @sp_number_abs, 0, @sp_im_cw, @sp_im_ch)
  258.        @sp_number_bitmap.blt(20 + ((@sp_im_cw - 7) *  r), 0, @sp_number_image, @sp_src_rect)        
  259.     end     
  260.     @sp_flow = 0
  261.     @sp_damage_flow = 0
  262.     @sp_image = RPG::Cache.windowskin("Hud_SP_Meter")
  263.     @sp_bitmap = Bitmap.new(@sp_image.width,@sp_image.height)
  264.     @sp_range = @sp_image.width / 3
  265.     @sp_width = @sp_range  * @actor.sp / @actor.maxsp  
  266.     @sp_height = @sp_image.height / 2
  267.     @sp_width_old = @sp_width
  268.     @sp_src_rect = Rect.new(@sp_range, 0, @sp_width, @sp_height)
  269.     @sp_bitmap.blt(0,0, @sp_image, @sp_src_rect)
  270.     @sp_sprite = Sprite.new
  271.     @sp_sprite.bitmap = @sp_bitmap
  272.     @sp_sprite.z = 5008
  273.     @sp_sprite.x = HUD_X + SP_METER_X
  274.     @sp_sprite.y = HUD_Y + SP_METER_Y
  275.     sp_flow_update
  276.     sp_number_refresh
  277.     # Level ---------------------------------------------------------------------
  278.     @level_image = RPG::Cache.windowskin("Hud_Exp_Meter")
  279.     @level_bitmap = Bitmap.new(@level_image.width,@level_image.height)
  280.     @level_sprite = Sprite.new   
  281.     if @actor.next_exp != 0
  282.     rate = @actor.now_exp.to_f / @actor.next_exp
  283.     else
  284.     rate = 1
  285.     end
  286.     if @actor.level < 99
  287.     @level_cw = @level_image.width * rate
  288.     else
  289.     @level_cw = @level_image.width
  290.     end      
  291.     @level_src_rect_back = Rect.new(0, 0,@level_cw, @level_image.height)
  292.     @level_bitmap.blt(0,0, @level_image, @level_src_rect_back)
  293.     @level_sprite.bitmap = @level_bitmap
  294.     @level_sprite.z = 5007
  295.     @level_sprite.x = HUD_X + EXP_METER_X
  296.     @level_sprite.y = HUD_Y + EXP_METER_Y   
  297.     # Level Number ---------------------------------------------------------------------
  298.     @level_number_image = RPG::Cache.windowskin("Hud_Exp_Number")
  299.     @level_number_bitmap = Bitmap.new(@level_number_image.width,@level_number_image.height)
  300.     @level_number_sprite = Sprite.new
  301.     @level_number_sprite.bitmap = @level_number_bitmap
  302.     @level_number_sprite.z = 5000
  303.     @level_number_sprite.x = HUD_X + EXP_NUMBER_X
  304.     @level_number_sprite.y = HUD_Y + EXP_NUMBER_Y
  305.     @level_im_cw = @level_number_image.width / 10
  306.     @level_im_ch = @level_number_image.height     
  307.     @level_number_text = @actor.level.abs.to_s.split(//)
  308.     for r in 0..@level_number_text.size - 1
  309.        @level_number_abs = @level_number_text[r].to_i
  310.        @level_src_rect = Rect.new(@level_im_cw * @level_number_abs, 0, @level_im_cw, @level_im_ch)
  311.        @level_number_bitmap.blt(13 + ((@level_im_cw - 12) *  r), 0, @level_number_image, @level_src_rect)        
  312.     end  
  313.     visible_on     
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # * Dispose
  317.   #--------------------------------------------------------------------------
  318.   def dispose
  319.     return if @actor == nil
  320.     #Hp Number Dispose
  321.     @hp_number_sprite.bitmap.dispose
  322.     @hp_number_sprite.bitmap = nil
  323.     @hp_number_sprite.dispose
  324.     @hp_number_sprite = nil
  325.     @hp_number_bitmap.dispose
  326.     @hp_number_bitmap = nil
  327.     #HP Meter Dispose
  328.     @hp_sprite.bitmap.dispose
  329.     @hp_sprite.bitmap = nil
  330.     @hp_sprite.dispose
  331.     @hp_sprite = nil  
  332.     @hp_bitmap.dispose
  333.     @hp_bitmap = nil
  334.     #SP Number Dispose
  335.     @sp_number_sprite.bitmap.dispose
  336.     @sp_number_sprite.bitmap = nil
  337.     @sp_number_sprite.dispose
  338.     @sp_number_sprite = nil
  339.     @sp_number_bitmap.dispose
  340.     @sp_number_bitmap = nil
  341.     #SP Meter Dispose
  342.     @sp_sprite.bitmap.dispose
  343.     @sp_sprite.bitmap = nil
  344.     @sp_sprite.dispose
  345.     @sp_sprite = nil   
  346.     @sp_bitmap.dispose
  347.     @sp_bitmap = nil
  348.     #States Dispose
  349.     @states.bitmap.dispose
  350.     @states.bitmap = nil
  351.     @states.dispose
  352.     @states = nil
  353.     #Level Meter Dispose
  354.     @level_sprite.bitmap.dispose
  355.     @level_sprite.bitmap = nil
  356.     @level_sprite.dispose
  357.     @level_sprite = nil   
  358.     @level_bitmap.dispose
  359.     @level_bitmap = nil     
  360.     #Level Number Dispose
  361.     @level_number_sprite.bitmap.dispose
  362.     @level_number_sprite.bitmap = nil
  363.     @level_number_sprite.dispose
  364.     @level_number_sprite = nil   
  365.     @level_number_bitmap.dispose
  366.     @level_number_bitmap = nil
  367.     #Layout Dispose
  368.     @layout_sprite.bitmap.dispose
  369.     @layout_sprite.bitmap = nil
  370.     @layout_sprite.dispose
  371.     @layout_sprite = nil   
  372.     @layout_bitmap.dispose
  373.     @layout_bitmap = nil      
  374.     #Face Dispose
  375.     @face_sprite.bitmap.dispose
  376.     @face_sprite.bitmap = nil
  377.     @face_sprite.dispose
  378.     @face_sprite = nil   
  379.     @face_bitmap.dispose
  380.     @face_bitmap = nil   
  381.   end
  382.   #--------------------------------------------------------------------------
  383.   # * Visible_on
  384.   #--------------------------------------------------------------------------
  385.   def visible_on
  386.     #Visible
  387.     if $game_switches[MOG::DISABLE_HUD_SWITCH] == true
  388.          @hp_number_sprite.visible = false   
  389.          @hp_sprite.visible = false  
  390.          @sp_number_sprite.visible = false
  391.          @sp_sprite.visible = false   
  392.          @states.visible = false
  393.          @level_sprite.visible = false
  394.          @level_number_sprite.visible = false
  395.          @layout_sprite.visible = false
  396.          @face_sprite.visible = false
  397.     else   
  398.          @hp_number_sprite.visible = true
  399.          @hp_sprite.visible = true   
  400.          @sp_number_sprite.visible = true
  401.          @sp_sprite.visible = true   
  402.          @states.visible = true
  403.          @level_sprite.visible = true
  404.          @level_number_sprite.visible = true
  405.          @layout_sprite.visible = true
  406.          @face_sprite.visible = true
  407.     end      
  408.   end
  409.   #--------------------------------------------------------------------------
  410.   # * Updade
  411.   #--------------------------------------------------------------------------
  412.   def update
  413.      return if @actor == nil
  414.      visible_on
  415.      hp_number_update if @hp_old != @actor.hp
  416.      hp_number_refresh if @hp_refresh == true or @actor.hp == 0
  417.      sp_number_update if @sp_old != @actor.sp
  418.      sp_number_refresh if @sp_refresh == true
  419.      level_update if @level != @actor.level
  420.      level_up_effect if @level_number_sprite.zoom_x > 1.00  
  421.      exp_update if @exp != @actor.exp
  422.      states_effect if @states.zoom_x > 1.00  
  423.      face_chance if $game_temp.hud_face_refresh == true or $game_temp.hud_face_time == 1
  424.      face_normal if $game_temp.hud_face_time2 == 1
  425.      face_effect
  426.      states_update
  427.      hp_flow_update
  428.      sp_flow_update
  429.      fade_update if HUD_FADE == true
  430.      $game_temp.hud_face_time -= 1 if $game_temp.hud_face_time > 0
  431.      $game_temp.hud_face_time2 -= 1 if $game_temp.hud_face_time2 > 0
  432.    end
  433.   #--------------------------------------------------------------------------
  434.   # fade_update
  435.   #--------------------------------------------------------------------------
  436.   def fade_update
  437.       x = ($game_player.real_x - $game_map.display_x) / 4
  438.       y = ($game_player.real_y - $game_map.display_y) / 4
  439.       if x < @oc_range_x and x > HUD_X - 5 and
  440.          y > HUD_Y and y < @oc_range_y and
  441.          @hp_number_sprite.opacity > 120
  442.          @hp_number_sprite.opacity -= 10
  443.          @hp_sprite.opacity -= 10
  444.          @sp_number_sprite.opacity -= 10
  445.          @sp_sprite.opacity -= 10
  446.          @states.opacity -= 10
  447.          @level_sprite.opacity -= 10
  448.          @level_number_sprite.opacity -= 10
  449.          @layout_sprite.opacity -= 10
  450.          @face_sprite.opacity -= 10     
  451.        elsif @hp_number_sprite.opacity < 255
  452.          @hp_number_sprite.opacity += 10
  453.          @hp_sprite.opacity += 10
  454.          @sp_number_sprite.opacity += 10
  455.          @sp_sprite.opacity += 10
  456.          @states.opacity += 10
  457.          @level_sprite.opacity += 10
  458.          @level_number_sprite.opacity += 10
  459.          @layout_sprite.opacity += 10
  460.          @face_sprite.opacity += 10           
  461.       end
  462.   end  
  463.   #--------------------------------------------------------------------------
  464.   # * face_normal
  465.   #--------------------------------------------------------------------------
  466.   def face_normal
  467.     $game_temp.hud_face_refresh = false
  468.     if @actor.hp < @actor.maxhp * @low_hp / 100
  469.        $game_temp.hud_face_type = 4
  470.     else  
  471.        $game_temp.hud_face_type = 0
  472.     end
  473.     $game_temp.hud_face_time2 = 0
  474.     @face_sprite.bitmap.clear
  475.     @face_src_rect_back = Rect.new(@face_cw * $game_temp.hud_face_type, 0,@face_cw , @face_ch)
  476.     @face_bitmap.blt(0,0, @face_image, @face_src_rect_back)   
  477.     @face_sprite.x = HUD_X + FACE_X
  478.   end  
  479.   #--------------------------------------------------------------------------
  480.   # * Face Chance
  481.   #--------------------------------------------------------------------------
  482.    def face_chance     
  483.     $game_temp.hud_face_refresh = false
  484.     @face_sprite.bitmap.clear
  485.     @face_src_rect_back = Rect.new(@face_cw * $game_temp.hud_face_type, 0,@face_cw , @face_ch)
  486.     @face_bitmap.blt(0,0, @face_image, @face_src_rect_back)
  487.     @face_sprite.x = HUD_X + FACE_X
  488.    end
  489.   #--------------------------------------------------------------------------
  490.   # * Face Effect
  491.   #--------------------------------------------------------------------------
  492.   def face_effect
  493.     if $game_temp.hud_face_type == 2
  494.        @face_sprite.x = HUD_X + FACE_X + rand(10)
  495.        if $game_temp.hud_face_time == 2
  496.          if @actor.hp < @actor.maxhp * @low_hp / 100
  497.             $game_temp.hud_face_type = 4
  498.          else            
  499.             $game_temp.hud_face_type = 0
  500.          end
  501.        end
  502.     end
  503.   end  
  504.   #--------------------------------------------------------------------------
  505.   # * States_Update
  506.   #--------------------------------------------------------------------------
  507.   def states_update
  508.     if STATES_POS_CHARACTER == true  
  509.       @states.x = 5 -(13 * @states_x) + $game_player.screen_x
  510.       @states.y = @states_y + $game_player.screen_y
  511.     else
  512.       @states.x = HUD_X + STATES_X
  513.       @states.y = @states_y + HUD_Y + STATES_Y
  514.     end
  515.     if FLOAT_STATES == true
  516.      if @states_f == false
  517.         @states_y += 1
  518.         @states_f = true if @states_y > 10
  519.      else   
  520.         @states_y -= 1
  521.         @states_f = false if @states_y < -10               
  522.       end  
  523.      end
  524.      @states.opacity = 155 + rand(100)
  525.      if @states_x != @actor.states.size
  526.         @states_x = @actor.states.size
  527.         @states.bitmap.clear
  528.         @states_max = 0
  529.         sta = []
  530.         for i in @actor.states
  531.            unless @states_max > 3
  532.              sta.push($data_states[i].name)
  533.              image = RPG::Cache.icon(sta[@states_max])
  534.              cw = image.width
  535.              ch = image.height
  536.              @states.bitmap.blt(26 * @states_max, 0, image, Rect.new(0, 0, cw, ch))
  537.              @states_max += 1
  538.            end
  539.          end  
  540.        sta = nil
  541.        @states.zoom_x = 2
  542.        @states.zoom_y = 2
  543.      end
  544.    end
  545.   #--------------------------------------------------------------------------
  546.   # * States_Effect
  547.   #--------------------------------------------------------------------------
  548.    def states_effect
  549.        @states.zoom_x -= 0.02
  550.        @states.zoom_y -= 0.02
  551.     if @states.zoom_x <= 1.00     
  552.        @states.zoom_x = 1.00
  553.        @states.zoom_y = 1.00
  554.     end  
  555.    end
  556.   #--------------------------------------------------------------------------
  557.   # * hp_number_update
  558.   #--------------------------------------------------------------------------
  559.   def hp_number_update
  560.        @hp_refresh = true
  561.        if @hp_old < @actor.hp
  562.            @hp_ref = 5 * (@actor.hp - @hp_old) / 100
  563.            @hp_ref = 1 if @hp_ref < 1
  564.            @hp += @hp_ref     
  565.            if $game_temp.hud_face_type != 1
  566.               $game_temp.hud_face_type = 1
  567.               $game_temp.hud_face_refresh = true
  568.               @face_sprite.x = HUD_X + FACE_X
  569.            end           
  570.            if @hp >= @actor.hp
  571.               @hp_old = @actor.hp
  572.               @hp = @actor.hp   
  573.               @hp_ref = 0
  574.              if @actor.hp < @actor.maxhp * @low_hp / 100 and
  575.                 $game_temp.hud_face_type != 4
  576.                 $game_temp.hud_face_type = 4
  577.                 $game_temp.hud_face_time = 30               
  578.              elsif $game_temp.hud_face_type != 0
  579.                 $game_temp.hud_face_type = 0
  580.                 $game_temp.hud_face_time = 30
  581.              end   
  582.            end  
  583.             
  584.         elsif @hp_old > @actor.hp   
  585.            @hp_refresh = true
  586.            @hp_ref = 5 * (@hp_old - @actor.hp) / 100
  587.            @hp_ref = 1 if @hp_ref < 1
  588.            @hp -= @hp_ref               
  589.            if $game_temp.hud_face_type != 2
  590.               $game_temp.hud_face_type = 2
  591.               $game_temp.hud_face_refresh = true              
  592.            end
  593.            if @hp <= @actor.hp
  594.               @hp_old = @actor.hp
  595.               @hp = @actor.hp   
  596.               @hp_ref = 0
  597.             if $game_temp.hud_face_type != 0
  598.                 $game_temp.hud_face_time = 30
  599.              end   
  600.            end            
  601.         end  
  602.    end  
  603.   #--------------------------------------------------------------------------
  604.   # * hp_number_refresh
  605.   #--------------------------------------------------------------------------
  606.   def hp_number_refresh
  607.       @hp_number_sprite.bitmap.clear
  608.       @hp_number_text = @hp.abs.to_s.split(//)
  609.       lowhp2 = @actor.maxhp * @low_hp / 100
  610.       if @actor.hp < lowhp2
  611.       @health2 = @im_ch
  612.       else
  613.       @health2 = 0
  614.       end
  615.       @hp_health = @health2
  616.       for r in 0..@hp_number_text.size - 1         
  617.          @hp_number_abs = @hp_number_text[r].to_i
  618.          @hp_src_rect = Rect.new(@im_cw * @hp_number_abs, @hp_health, @im_cw, @im_ch)
  619.          @hp_number_bitmap.blt(20 + ((@im_cw - 7) *  r), 0, @hp_number_image, @hp_src_rect)        
  620.        end  
  621.        @hp_refresh = false if @hp == @actor.hp
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # * Hp Flow Update
  625.   #--------------------------------------------------------------------------
  626.   def hp_flow_update
  627.       @hp_sprite.bitmap.clear
  628.       @hp_width = @hp_range  * @actor.hp / @actor.maxhp

  629.           #HP Damage---------------------------------
  630.           valor = (@hp_width_old - @hp_width) * 3 / 100
  631.           valor = 0.5 if valor < 1         
  632.           if @hp_width_old != @hp_width
  633.           @hp_width_old -= valor if @hp_width_old > @hp_width  
  634.           if @hp_width_old < @hp_width
  635.              @hp_width_old = @hp_width
  636.           end      
  637.           @hp_src_rect_old = Rect.new(@hp_flow, @hp_height,@hp_width_old, @hp_height)
  638.           @hp_bitmap.blt(0,0, @hp_image, @hp_src_rect_old)      
  639.           end
  640.         
  641.       #HP Real------------------------------------
  642.       @hp_src_rect = Rect.new(@hp_flow, 0,@hp_width, @hp_height)
  643.       @hp_bitmap.blt(0,0, @hp_image, @hp_src_rect)
  644.          
  645.       @hp_flow += 5  
  646.       if @hp_flow >= @hp_image.width - @hp_range
  647.          @hp_flow = 0  
  648.       end
  649.   end     
  650.   #--------------------------------------------------------------------------
  651.   # * Sp_number_update
  652.   #--------------------------------------------------------------------------
  653.   def sp_number_update
  654.     @sp_refresh = true
  655.     if @sp_old < @actor.sp
  656.        @sp_refresh = true
  657.        @sp_ref = 5 * (@actor.sp - @sp_old) / 100
  658.        @sp_ref = 1 if @sp_ref < 1
  659.        @sp += @sp_ref  
  660.            if $game_temp.hud_face_type != 1
  661.               $game_temp.hud_face_type = 1
  662.               $game_temp.hud_face_refresh = true
  663.               @face_sprite.x = HUD_X + FACE_X
  664.            end           
  665.        if @sp >= @actor.sp
  666.           @sp_old = @actor.sp
  667.           @sp = @actor.sp   
  668.           @sp_ref = 0
  669.              if @actor.hp < @actor.maxhp * @low_hp / 100 and
  670.                 $game_temp.hud_face_type != 4
  671.                 $game_temp.hud_face_type = 4
  672.                 $game_temp.hud_face_time = 30               
  673.              elsif $game_temp.hud_face_type != 0
  674.                 $game_temp.hud_face_type = 0
  675.                 $game_temp.hud_face_time = 30
  676.              end           
  677.        end  
  678.     elsif @sp_old >= @actor.sp   
  679.        @sp_ref = 5 * (@sp_old - @actor.sp) / 100
  680.        @sp_ref = 1 if @sp_ref < 1
  681.        @sp -= @sp_ref     
  682.            if $game_temp.hud_face_type != 3
  683.               $game_temp.hud_face_type = 3
  684.               $game_temp.hud_face_refresh = true
  685.            end      
  686.        if @sp <= @actor.sp
  687.           @sp_old = @actor.sp
  688.           @sp = @actor.sp   
  689.           @sp_ref = 0
  690.              if @actor.hp < @actor.maxhp * @low_hp / 100 and
  691.                 $game_temp.hud_face_type != 4
  692.                 $game_temp.hud_face_type = 4
  693.                 $game_temp.hud_face_time = 35               
  694.              elsif $game_temp.hud_face_type != 0
  695.                 $game_temp.hud_face_type = 0
  696.                 $game_temp.hud_face_time = 35
  697.              end              
  698.         end         
  699.     end     
  700.   end  
  701.   #--------------------------------------------------------------------------
  702.   # * sp_number_refresh
  703.   #--------------------------------------------------------------------------
  704.   def sp_number_refresh
  705.     @sp_number_sprite.bitmap.clear
  706.     @s = @actor.sp * 100 / @actor.maxsp
  707.     @sp_number_text = @sp.abs.to_s.split(//)
  708.       for r in 0..@sp_number_text.size - 1         
  709.          @sp_number_abs = @sp_number_text[r].to_i
  710.          if @actor.sp <= @actor.maxsp * @low_sp / 100
  711.          @sp_src_rect = Rect.new(@sp_im_cw * @sp_number_abs, @sp_im_ch, @sp_im_cw, @sp_im_ch)  
  712.          else  
  713.          @sp_src_rect = Rect.new(@sp_im_cw * @sp_number_abs, 0, @sp_im_cw, @sp_im_ch)
  714.          end
  715.        @sp_number_bitmap.blt(20 + ((@sp_im_cw - 7) *  r), 0, @sp_number_image, @sp_src_rect)        
  716.      end  
  717.      @sp_refresh = false if @sp == @actor.sp
  718.   end      
  719.   #--------------------------------------------------------------------------
  720.   # * Sp Flow Update
  721.   #--------------------------------------------------------------------------
  722.   def sp_flow_update
  723.       @sp_sprite.bitmap.clear
  724.       @sp_width = @sp_range  * @actor.sp / @actor.maxsp
  725.           #SP Damage---------------------------------
  726.           if @sp_width_old != @sp_width
  727.           valor = (@sp_width_old - @sp_width) * 3 / 100
  728.           valor = 0.5 if valor < 1              
  729.           @sp_width_old -= valor if @sp_width_old > @sp_width  
  730.           if @sp_width_old < @sp_width
  731.              @sp_width_old = @sp_width
  732.           end      
  733.           @sp_src_rect_old = Rect.new(@sp_flow, @sp_height,@sp_width_old, @sp_height)
  734.           @sp_bitmap.blt(0,0, @sp_image, @sp_src_rect_old)
  735.           end
  736.       #SP Real------------------------------------
  737.       @sp_src_rect = Rect.new(@sp_flow, 0,@sp_width, @sp_height)
  738.       @sp_bitmap.blt(0,0, @sp_image, @sp_src_rect)
  739.       @sp_flow += 5  
  740.       if @sp_flow >= @sp_image.width - @sp_range
  741.          @sp_flow = 0  
  742.       end
  743.     end  
  744.   #--------------------------------------------------------------------------
  745.   # * level_update
  746.   #--------------------------------------------------------------------------
  747.   def level_update
  748.     @level_number_sprite.bitmap.clear
  749.     @level_number_text = @actor.level.abs.to_s.split(//)
  750.     for r in 0..@level_number_text.size - 1
  751.        @level_number_abs = @level_number_text[r].to_i
  752.        @level_src_rect = Rect.new(@level_im_cw * @level_number_abs, 0, @level_im_cw, @level_im_ch)
  753.        @level_number_bitmap.blt(13 + ((@level_im_cw - 12) *  r), 0, @level_number_image, @level_src_rect)        
  754.     end      
  755.     @level = @actor.level
  756.     @level_number_sprite.zoom_x = 2
  757.     @level_number_sprite.zoom_y = 2
  758.   end
  759.   #--------------------------------------------------------------------------
  760.   # * level_update
  761.   #--------------------------------------------------------------------------
  762.   def level_up_effect
  763.     @level_number_sprite.zoom_x -= 0.02
  764.     @level_number_sprite.zoom_y -= 0.02
  765.     if @level_number_sprite.zoom_x <= 1.00     
  766.        @level_number_sprite.zoom_x = 1.00
  767.        @level_number_sprite.zoom_y = 1.00
  768.     end
  769.   end  
  770.   #--------------------------------------------------------------------------
  771.   # * exp_update
  772.   #--------------------------------------------------------------------------
  773.   def exp_update
  774.     @level_sprite.bitmap.clear   
  775.     if @actor.next_exp != 0
  776.     rate = @actor.now_exp.to_f / @actor.next_exp
  777.     else
  778.     rate = 1
  779.     end
  780.     if @actor.level < 99
  781.     @level_cw = @level_image.width * rate
  782.     else
  783.     @level_cw = @level_image.width
  784.     end      
  785.     @level_src_rect_back = Rect.new(0, 0,@level_cw, @level_image.height)
  786.     @level_bitmap.blt(0,0, @level_image, @level_src_rect_back)  
  787.     @exp = @actor.exp
  788.   end  
  789. end
  790. #===============================================================================
  791. # Scene_Map
  792. #===============================================================================
  793. class Scene_Map  
  794.   alias acthud_main main
  795. #--------------------------------------------------------------------------
  796. # Main
  797. #--------------------------------------------------------------------------
  798.   def main
  799.       @viewport = Viewport.new(0, 0, 640, 480)
  800.       @viewport.z = 9999     
  801.       @acthud = Active_Hud.new(@viewport)
  802.     acthud_main   
  803.       @acthud.dispose
  804.       @acthud = nil
  805.       @viewport.dispose
  806.       @viewport = nil
  807.   end  
  808. #--------------------------------------------------------------------------
  809. # Update
  810. #--------------------------------------------------------------------------   
  811.   alias acthud_update update
  812.   def update
  813.     acthud_update
  814.     @acthud.update
  815.   end  
  816. end

  817. $mog_rgss_active_hud = true
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-12-26 14:11

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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