赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 0 |
经验 | 0 |
最后登录 | 2013-3-28 |
在线时间 | 16 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 450
- 在线时间
- 16 小时
- 注册时间
- 2012-12-8
- 帖子
- 4
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
找到了一个脚本,但我不想要HP 和SP 血量条的动画效果,就是会闪耀的效果
本人新手,所以看不懂代码.求求修改.教我也可以.
- #_______________________________________________________________________________
- # MOG - Active Hud 1.2
- #_______________________________________________________________________________
- # By Moghunter
- # http://www.atelier-rgss.com
- #_______________________________________________________________________________
- # - 在地图显示角色的各种信息
- # 显示图像:(HP,SP,头像,Exp,level)
- #
- # 所需文件:
- #
- # Hud_Exp_Meter.png
- # Hud_Exp_Number.png
- # Hud_Face.png
- # Hud_HP_Meter.png
- # Hud_HP_Number.png
- # Hud_Layout.png
- # Hud_SP_Meter.png
- # Hud_SP_Number.png
- #
- # 文件存放在Windowskins文件夹下
- #
- # 动画(角色的表情变化)
- # 显示图像变化需要一个名为" Hud_Face.png "的文件。
- # 表情变化有5种类型,如下所示:
- # 1 - 正常 2 - 微笑 3 - 悲伤 4 - 怒 5 - 疲劳
- #
- # MEDIDORES ANIMADOS
- #
- #_______________________________________________________________________________
- # UPDATE
- # 1.1 - 使用SP相关
- # 1.2 - 添加淡入淡出效果。
- #_______________________________________________________________________________
- module MOG
- # HUD坐标
- HUD_X = 0
- HUD_Y = 400
- # HP 条形图像坐标
- HP_METER_X = 73
- HP_METER_Y = 42
- # HP 文字图像坐标
- HP_NUMBER_X = 95
- HP_NUMBER_Y = 30
- # SP 条形图像坐标
- SP_METER_X = 33
- SP_METER_Y = 64
- # SP 文字图像坐标
- SP_NUMBER_X = 55
- SP_NUMBER_Y = 53
- # EXP 条形图像坐标
- EXP_METER_X = 60
- EXP_METER_Y = 26
- #LV 文字图像的坐标
- EXP_NUMBER_X = 60
- EXP_NUMBER_Y = 5
- #背景图像的坐标
- LAYOUT_X = 5
- LAYOUT_Y = 10
- #头像的坐标
- FACE_X = 5
- FACE_Y = 10
- #状态图标是否显示在角色脚下
- STATES_POS_CHARACTER = false
- #状态图标是否有悬浮效果
- FLOAT_STATES = true
- #状态坐标的坐标
- STATES_X = 150
- STATES_Y = 50
- #HP底下的百分比,影响角色的头像
- LOWHP = 30
- #HUD 界面的开关号
- DISABLE_HUD_SWITCH = 5
- #角色接触HUD时是否有半透明效果
- HUD_FADE = true
- #半透明效果的传感器
- HUD_SIZE_X = 180
- HUD_SIZE_Y = 100
- end
- #==============================================================================
- # Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
-
- #--------------------------------------------------------------------------
- # Now Exp
- #--------------------------------------------------------------------------
- def now_exp
- return [url=home.php?mod=space&uid=13302]@exp[/url] - @exp_list[@level]
- end
-
- #--------------------------------------------------------------------------
- # Next Exp
- #--------------------------------------------------------------------------
- def next_exp
- return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
- end
- end
- #==============================================================================
- # Game_Temp
- #==============================================================================
- class Game_Temp
- attr_accessor :hud_face_type
- attr_accessor :hud_face_time
- attr_accessor :hud_face_time2
- attr_accessor :hud_face_refresh
-
- #--------------------------------------------------------------------------
- # Initialize
- #--------------------------------------------------------------------------
- alias active_hud_initialize initialize
- def initialize
- active_hud_initialize
- @hud_face_type = 0
- @hud_face_time = 0
- @hud_face_time2 = 0
- @hud_face_refresh = false
- end
- end
- #==============================================================================
- # Active_Hud
- #==============================================================================
- class Active_Hud < Sprite
- include MOG
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize(viewport)
- super(viewport)
- [url=home.php?mod=space&uid=95897]@actor[/url] = $game_party.actors[0]
- return if @actor == nil
- @low_sp = LOWHP
- @low_hp = LOWHP
- @hp = @actor.hp
- @sp = @actor.sp
- @exp = @actor.exp
- [url=home.php?mod=space&uid=22147]@level[/url] = @actor.level
- @hp_old = @actor.hp
- @hp_ref = @hp_old
- @hp_refresh = false
- @sp_old = @actor.sp
- @sp_ref = @sp_old
- @sp_refresh = false
- hud_size_x = HUD_SIZE_X
- hud_size_y = HUD_SIZE_Y
- @oc_range_x = hud_size_x + HUD_X
- @oc_range_y = hud_size_y + HUD_Y
- # Layout -------------------------------------------------------------------
- @layout_image = RPG::Cache.windowskin("Hud_Layout")
- @layout_bitmap = Bitmap.new(@layout_image.width,@layout_image.height)
- @layout_sprite = Sprite.new
- @layout_sprite.bitmap = @layout_bitmap
- @layout_src_rect_back = Rect.new(0, 0,@layout_image.width, @layout_image.height)
- @layout_bitmap.blt(0,0, @layout_image, @layout_src_rect_back)
- @layout_sprite.z = 5007
- @layout_sprite.x = HUD_X + LAYOUT_X
- @layout_sprite.y = HUD_Y + LAYOUT_Y
- # Layout -------------------------------------------------------------------
- @face_image = RPG::Cache.windowskin("Hud_Face")
- @face_bitmap = Bitmap.new(@face_image.width,@face_image.height)
- @face_sprite = Sprite.new
- @face_sprite.bitmap = @face_bitmap
- @face_cw = @face_bitmap.width / 5
- @face_ch = @face_bitmap.height
- @face_src_rect_back = Rect.new(@face_cw * $game_temp.hud_face_type, 0,@face_cw , @face_ch)
- @face_bitmap.blt(0,0, @face_image, @face_src_rect_back)
- @face_sprite.z = 5007
- @face_sprite.x = HUD_X + FACE_X
- @face_sprite.y = HUD_Y + FACE_Y
- if @actor.hp < @actor.maxhp * @low_hp / 100
- $game_temp.hud_face_type = 4
- else
- $game_temp.hud_face_type = 0
- end
- $game_temp.hud_face_time = 10
- # States -------------------------------------------------------------------
- @states_max = 0
- @states = Sprite.new
- @states.bitmap = Bitmap.new(104,24)
- @states_x = @actor.states.size
- @states_y = 0
- @states_f = false
- sta = []
- for i in @actor.states
- unless @states_max > 3
- sta.push($data_states[i].name)
- image = RPG::Cache.icon(sta[@states_max])
- cw = image.width
- ch = image.height
- @states.bitmap.blt(26 * @states_max, 0, image, Rect.new(0, 0, cw, ch))
- @states_max += 1
- end
- end
- if STATES_POS_CHARACTER == true
- @states.x = 5 -(13 * @states_x) + $game_player.screen_x
- @states.y = @states_y + $game_player.screen_y
- else
- @states.x = HUD_X + STATES_X
- @states.y = @states_y + HUD_Y + STATES_Y
- end
- @states.z = 5009
- # HP ---------------------------------------------------------------------
- @hp_number_image = RPG::Cache.windowskin("Hud_HP_Number")
- @hp_number_bitmap = Bitmap.new(@hp_number_image.width,@hp_number_image.height)
- @hp_number_sprite = Sprite.new
- @hp_number_sprite.bitmap = @hp_number_bitmap
- @hp_number_sprite.z = 5009
- @hp_number_sprite.x = HUD_X + HP_NUMBER_X
- @hp_number_sprite.y = HUD_Y + HP_NUMBER_Y
- @im_cw = @hp_number_image.width / 10
- @im_ch = @hp_number_image.height / 2
- @hp_src_rect = Rect.new(@im_cw,0, @im_cw, @im_ch)
- @hp_number_text = @actor.hp.abs.to_s.split(//)
- lowhp2 = @actor.maxhp * 30 / 100
- if @actor.hp < lowhp2
- @health2 = @im_ch
- else
- @health2 = 0
- end
- @hp_health = @health2
- for r in 0..@hp_number_text.size - 1
- @hp_number_abs = @hp_number_text[r].to_i
- @hp_src_rect = Rect.new(@im_cw * @hp_number_abs, @hp_health, @im_cw, @im_ch)
- @hp_number_bitmap.blt(20 + ((@im_cw - 7) * r), 0, @hp_number_image, @hp_src_rect)
- end
- @hp_flow = 0
- @hp_damage_flow = 0
- @hp_image = RPG::Cache.windowskin("Hud_HP_Meter")
- @hp_bitmap = Bitmap.new(@hp_image.width,@hp_image.height)
- @hp_range = @hp_image.width / 3
- @hp_width = @hp_range * @actor.hp / @actor.maxhp
- @hp_height = @hp_image.height / 2
- @hp_width_old = @hp_width
- @hp_src_rect = Rect.new(@hp_range, 0, @hp_width, @hp_height)
- @hp_bitmap.blt(0,0, @hp_image, @hp_src_rect)
- @hp_sprite = Sprite.new
- @hp_sprite.bitmap = @hp_bitmap
- @hp_sprite.z = 5008
- @hp_sprite.x = HUD_X + HP_METER_X
- @hp_sprite.y = HUD_Y + HP_METER_Y
- hp_flow_update
- hp_number_refresh
- # SP ---------------------------------------------------------------------
- @sp_number_image = RPG::Cache.windowskin("Hud_SP_Number")
- @sp_number_bitmap = Bitmap.new(@sp_number_image.width,@sp_number_image.height)
- @sp_number_sprite = Sprite.new
- @sp_number_sprite.bitmap = @sp_number_bitmap
- @sp_number_sprite.z = 5009
- @sp_number_sprite.x = HUD_X + SP_NUMBER_X
- @sp_number_sprite.y = HUD_Y + SP_NUMBER_Y
- @sp_im_cw = @sp_number_image.width / 10
- @sp_im_ch = @sp_number_image.height / 2
- @sp_src_rect = Rect.new(@sp_im_cw,0, @sp_im_cw, @sp_im_ch)
- @sp_number_text = @actor.sp.abs.to_s.split(//)
- for r in 0..@sp_number_text.size - 1
- @sp_number_abs = @sp_number_text[r].to_i
- @sp_src_rect = Rect.new(@sp_im_cw * @sp_number_abs, 0, @sp_im_cw, @sp_im_ch)
- @sp_number_bitmap.blt(20 + ((@sp_im_cw - 7) * r), 0, @sp_number_image, @sp_src_rect)
- end
- @sp_flow = 0
- @sp_damage_flow = 0
- @sp_image = RPG::Cache.windowskin("Hud_SP_Meter")
- @sp_bitmap = Bitmap.new(@sp_image.width,@sp_image.height)
- @sp_range = @sp_image.width / 3
- @sp_width = @sp_range * @actor.sp / @actor.maxsp
- @sp_height = @sp_image.height / 2
- @sp_width_old = @sp_width
- @sp_src_rect = Rect.new(@sp_range, 0, @sp_width, @sp_height)
- @sp_bitmap.blt(0,0, @sp_image, @sp_src_rect)
- @sp_sprite = Sprite.new
- @sp_sprite.bitmap = @sp_bitmap
- @sp_sprite.z = 5008
- @sp_sprite.x = HUD_X + SP_METER_X
- @sp_sprite.y = HUD_Y + SP_METER_Y
- sp_flow_update
- sp_number_refresh
- # Level ---------------------------------------------------------------------
- @level_image = RPG::Cache.windowskin("Hud_Exp_Meter")
- @level_bitmap = Bitmap.new(@level_image.width,@level_image.height)
- @level_sprite = Sprite.new
- if @actor.next_exp != 0
- rate = @actor.now_exp.to_f / @actor.next_exp
- else
- rate = 1
- end
- if @actor.level < 99
- @level_cw = @level_image.width * rate
- else
- @level_cw = @level_image.width
- end
- @level_src_rect_back = Rect.new(0, 0,@level_cw, @level_image.height)
- @level_bitmap.blt(0,0, @level_image, @level_src_rect_back)
- @level_sprite.bitmap = @level_bitmap
- @level_sprite.z = 5007
- @level_sprite.x = HUD_X + EXP_METER_X
- @level_sprite.y = HUD_Y + EXP_METER_Y
- # Level Number ---------------------------------------------------------------------
- @level_number_image = RPG::Cache.windowskin("Hud_Exp_Number")
- @level_number_bitmap = Bitmap.new(@level_number_image.width,@level_number_image.height)
- @level_number_sprite = Sprite.new
- @level_number_sprite.bitmap = @level_number_bitmap
- @level_number_sprite.z = 5000
- @level_number_sprite.x = HUD_X + EXP_NUMBER_X
- @level_number_sprite.y = HUD_Y + EXP_NUMBER_Y
- @level_im_cw = @level_number_image.width / 10
- @level_im_ch = @level_number_image.height
- @level_number_text = @actor.level.abs.to_s.split(//)
- for r in 0..@level_number_text.size - 1
- @level_number_abs = @level_number_text[r].to_i
- @level_src_rect = Rect.new(@level_im_cw * @level_number_abs, 0, @level_im_cw, @level_im_ch)
- @level_number_bitmap.blt(13 + ((@level_im_cw - 12) * r), 0, @level_number_image, @level_src_rect)
- end
- visible_on
- end
- #--------------------------------------------------------------------------
- # * Dispose
- #--------------------------------------------------------------------------
- def dispose
- return if @actor == nil
- #Hp Number Dispose
- @hp_number_sprite.bitmap.dispose
- @hp_number_sprite.bitmap = nil
- @hp_number_sprite.dispose
- @hp_number_sprite = nil
- @hp_number_bitmap.dispose
- @hp_number_bitmap = nil
- #HP Meter Dispose
- @hp_sprite.bitmap.dispose
- @hp_sprite.bitmap = nil
- @hp_sprite.dispose
- @hp_sprite = nil
- @hp_bitmap.dispose
- @hp_bitmap = nil
- #SP Number Dispose
- @sp_number_sprite.bitmap.dispose
- @sp_number_sprite.bitmap = nil
- @sp_number_sprite.dispose
- @sp_number_sprite = nil
- @sp_number_bitmap.dispose
- @sp_number_bitmap = nil
- #SP Meter Dispose
- @sp_sprite.bitmap.dispose
- @sp_sprite.bitmap = nil
- @sp_sprite.dispose
- @sp_sprite = nil
- @sp_bitmap.dispose
- @sp_bitmap = nil
- #States Dispose
- @states.bitmap.dispose
- @states.bitmap = nil
- @states.dispose
- @states = nil
- #Level Meter Dispose
- @level_sprite.bitmap.dispose
- @level_sprite.bitmap = nil
- @level_sprite.dispose
- @level_sprite = nil
- @level_bitmap.dispose
- @level_bitmap = nil
- #Level Number Dispose
- @level_number_sprite.bitmap.dispose
- @level_number_sprite.bitmap = nil
- @level_number_sprite.dispose
- @level_number_sprite = nil
- @level_number_bitmap.dispose
- @level_number_bitmap = nil
- #Layout Dispose
- @layout_sprite.bitmap.dispose
- @layout_sprite.bitmap = nil
- @layout_sprite.dispose
- @layout_sprite = nil
- @layout_bitmap.dispose
- @layout_bitmap = nil
- #Face Dispose
- @face_sprite.bitmap.dispose
- @face_sprite.bitmap = nil
- @face_sprite.dispose
- @face_sprite = nil
- @face_bitmap.dispose
- @face_bitmap = nil
- end
- #--------------------------------------------------------------------------
- # * Visible_on
- #--------------------------------------------------------------------------
- def visible_on
- #Visible
- if $game_switches[MOG::DISABLE_HUD_SWITCH] == true
- @hp_number_sprite.visible = false
- @hp_sprite.visible = false
- @sp_number_sprite.visible = false
- @sp_sprite.visible = false
- @states.visible = false
- @level_sprite.visible = false
- @level_number_sprite.visible = false
- @layout_sprite.visible = false
- @face_sprite.visible = false
- else
- @hp_number_sprite.visible = true
- @hp_sprite.visible = true
- @sp_number_sprite.visible = true
- @sp_sprite.visible = true
- @states.visible = true
- @level_sprite.visible = true
- @level_number_sprite.visible = true
- @layout_sprite.visible = true
- @face_sprite.visible = true
- end
- end
- #--------------------------------------------------------------------------
- # * Updade
- #--------------------------------------------------------------------------
- def update
- return if @actor == nil
- visible_on
- hp_number_update if @hp_old != @actor.hp
- hp_number_refresh if @hp_refresh == true or @actor.hp == 0
- sp_number_update if @sp_old != @actor.sp
- sp_number_refresh if @sp_refresh == true
- level_update if @level != @actor.level
- level_up_effect if @level_number_sprite.zoom_x > 1.00
- exp_update if @exp != @actor.exp
- states_effect if @states.zoom_x > 1.00
- face_chance if $game_temp.hud_face_refresh == true or $game_temp.hud_face_time == 1
- face_normal if $game_temp.hud_face_time2 == 1
- face_effect
- states_update
- hp_flow_update
- sp_flow_update
- fade_update if HUD_FADE == true
- $game_temp.hud_face_time -= 1 if $game_temp.hud_face_time > 0
- $game_temp.hud_face_time2 -= 1 if $game_temp.hud_face_time2 > 0
- end
- #--------------------------------------------------------------------------
- # fade_update
- #--------------------------------------------------------------------------
- def fade_update
- x = ($game_player.real_x - $game_map.display_x) / 4
- y = ($game_player.real_y - $game_map.display_y) / 4
- if x < @oc_range_x and x > HUD_X - 5 and
- y > HUD_Y and y < @oc_range_y and
- @hp_number_sprite.opacity > 120
- @hp_number_sprite.opacity -= 10
- @hp_sprite.opacity -= 10
- @sp_number_sprite.opacity -= 10
- @sp_sprite.opacity -= 10
- @states.opacity -= 10
- @level_sprite.opacity -= 10
- @level_number_sprite.opacity -= 10
- @layout_sprite.opacity -= 10
- @face_sprite.opacity -= 10
- elsif @hp_number_sprite.opacity < 255
- @hp_number_sprite.opacity += 10
- @hp_sprite.opacity += 10
- @sp_number_sprite.opacity += 10
- @sp_sprite.opacity += 10
- @states.opacity += 10
- @level_sprite.opacity += 10
- @level_number_sprite.opacity += 10
- @layout_sprite.opacity += 10
- @face_sprite.opacity += 10
- end
- end
- #--------------------------------------------------------------------------
- # * face_normal
- #--------------------------------------------------------------------------
- def face_normal
- $game_temp.hud_face_refresh = false
- if @actor.hp < @actor.maxhp * @low_hp / 100
- $game_temp.hud_face_type = 4
- else
- $game_temp.hud_face_type = 0
- end
- $game_temp.hud_face_time2 = 0
- @face_sprite.bitmap.clear
- @face_src_rect_back = Rect.new(@face_cw * $game_temp.hud_face_type, 0,@face_cw , @face_ch)
- @face_bitmap.blt(0,0, @face_image, @face_src_rect_back)
- @face_sprite.x = HUD_X + FACE_X
- end
- #--------------------------------------------------------------------------
- # * Face Chance
- #--------------------------------------------------------------------------
- def face_chance
- $game_temp.hud_face_refresh = false
- @face_sprite.bitmap.clear
- @face_src_rect_back = Rect.new(@face_cw * $game_temp.hud_face_type, 0,@face_cw , @face_ch)
- @face_bitmap.blt(0,0, @face_image, @face_src_rect_back)
- @face_sprite.x = HUD_X + FACE_X
- end
- #--------------------------------------------------------------------------
- # * Face Effect
- #--------------------------------------------------------------------------
- def face_effect
- if $game_temp.hud_face_type == 2
- @face_sprite.x = HUD_X + FACE_X + rand(10)
- if $game_temp.hud_face_time == 2
- if @actor.hp < @actor.maxhp * @low_hp / 100
- $game_temp.hud_face_type = 4
- else
- $game_temp.hud_face_type = 0
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * States_Update
- #--------------------------------------------------------------------------
- def states_update
- if STATES_POS_CHARACTER == true
- @states.x = 5 -(13 * @states_x) + $game_player.screen_x
- @states.y = @states_y + $game_player.screen_y
- else
- @states.x = HUD_X + STATES_X
- @states.y = @states_y + HUD_Y + STATES_Y
- end
- if FLOAT_STATES == true
- if @states_f == false
- @states_y += 1
- @states_f = true if @states_y > 10
- else
- @states_y -= 1
- @states_f = false if @states_y < -10
- end
- end
- @states.opacity = 155 + rand(100)
- if @states_x != @actor.states.size
- @states_x = @actor.states.size
- @states.bitmap.clear
- @states_max = 0
- sta = []
- for i in @actor.states
- unless @states_max > 3
- sta.push($data_states[i].name)
- image = RPG::Cache.icon(sta[@states_max])
- cw = image.width
- ch = image.height
- @states.bitmap.blt(26 * @states_max, 0, image, Rect.new(0, 0, cw, ch))
- @states_max += 1
- end
- end
- sta = nil
- @states.zoom_x = 2
- @states.zoom_y = 2
- end
- end
- #--------------------------------------------------------------------------
- # * States_Effect
- #--------------------------------------------------------------------------
- def states_effect
- @states.zoom_x -= 0.02
- @states.zoom_y -= 0.02
- if @states.zoom_x <= 1.00
- @states.zoom_x = 1.00
- @states.zoom_y = 1.00
- end
- end
- #--------------------------------------------------------------------------
- # * hp_number_update
- #--------------------------------------------------------------------------
- def hp_number_update
- @hp_refresh = true
- if @hp_old < @actor.hp
- @hp_ref = 5 * (@actor.hp - @hp_old) / 100
- @hp_ref = 1 if @hp_ref < 1
- @hp += @hp_ref
- if $game_temp.hud_face_type != 1
- $game_temp.hud_face_type = 1
- $game_temp.hud_face_refresh = true
- @face_sprite.x = HUD_X + FACE_X
- end
- if @hp >= @actor.hp
- @hp_old = @actor.hp
- @hp = @actor.hp
- @hp_ref = 0
- if @actor.hp < @actor.maxhp * @low_hp / 100 and
- $game_temp.hud_face_type != 4
- $game_temp.hud_face_type = 4
- $game_temp.hud_face_time = 30
- elsif $game_temp.hud_face_type != 0
- $game_temp.hud_face_type = 0
- $game_temp.hud_face_time = 30
- end
- end
-
- elsif @hp_old > @actor.hp
- @hp_refresh = true
- @hp_ref = 5 * (@hp_old - @actor.hp) / 100
- @hp_ref = 1 if @hp_ref < 1
- @hp -= @hp_ref
- if $game_temp.hud_face_type != 2
- $game_temp.hud_face_type = 2
- $game_temp.hud_face_refresh = true
- end
- if @hp <= @actor.hp
- @hp_old = @actor.hp
- @hp = @actor.hp
- @hp_ref = 0
- if $game_temp.hud_face_type != 0
- $game_temp.hud_face_time = 30
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * hp_number_refresh
- #--------------------------------------------------------------------------
- def hp_number_refresh
- @hp_number_sprite.bitmap.clear
- @hp_number_text = @hp.abs.to_s.split(//)
- lowhp2 = @actor.maxhp * @low_hp / 100
- if @actor.hp < lowhp2
- @health2 = @im_ch
- else
- @health2 = 0
- end
- @hp_health = @health2
- for r in 0..@hp_number_text.size - 1
- @hp_number_abs = @hp_number_text[r].to_i
- @hp_src_rect = Rect.new(@im_cw * @hp_number_abs, @hp_health, @im_cw, @im_ch)
- @hp_number_bitmap.blt(20 + ((@im_cw - 7) * r), 0, @hp_number_image, @hp_src_rect)
- end
- @hp_refresh = false if @hp == @actor.hp
- end
- #--------------------------------------------------------------------------
- # * Hp Flow Update
- #--------------------------------------------------------------------------
- def hp_flow_update
- @hp_sprite.bitmap.clear
- @hp_width = @hp_range * @actor.hp / @actor.maxhp
-
- #HP Damage---------------------------------
- valor = (@hp_width_old - @hp_width) * 3 / 100
- valor = 0.5 if valor < 1
- if @hp_width_old != @hp_width
- @hp_width_old -= valor if @hp_width_old > @hp_width
- if @hp_width_old < @hp_width
- @hp_width_old = @hp_width
- end
- @hp_src_rect_old = Rect.new(@hp_flow, @hp_height,@hp_width_old, @hp_height)
- @hp_bitmap.blt(0,0, @hp_image, @hp_src_rect_old)
- end
-
- #HP Real------------------------------------
- @hp_src_rect = Rect.new(@hp_flow, 0,@hp_width, @hp_height)
- @hp_bitmap.blt(0,0, @hp_image, @hp_src_rect)
-
- @hp_flow += 5
- if @hp_flow >= @hp_image.width - @hp_range
- @hp_flow = 0
- end
- end
- #--------------------------------------------------------------------------
- # * Sp_number_update
- #--------------------------------------------------------------------------
- def sp_number_update
- @sp_refresh = true
- if @sp_old < @actor.sp
- @sp_refresh = true
- @sp_ref = 5 * (@actor.sp - @sp_old) / 100
- @sp_ref = 1 if @sp_ref < 1
- @sp += @sp_ref
- if $game_temp.hud_face_type != 1
- $game_temp.hud_face_type = 1
- $game_temp.hud_face_refresh = true
- @face_sprite.x = HUD_X + FACE_X
- end
- if @sp >= @actor.sp
- @sp_old = @actor.sp
- @sp = @actor.sp
- @sp_ref = 0
- if @actor.hp < @actor.maxhp * @low_hp / 100 and
- $game_temp.hud_face_type != 4
- $game_temp.hud_face_type = 4
- $game_temp.hud_face_time = 30
- elsif $game_temp.hud_face_type != 0
- $game_temp.hud_face_type = 0
- $game_temp.hud_face_time = 30
- end
- end
- elsif @sp_old >= @actor.sp
- @sp_ref = 5 * (@sp_old - @actor.sp) / 100
- @sp_ref = 1 if @sp_ref < 1
- @sp -= @sp_ref
- if $game_temp.hud_face_type != 3
- $game_temp.hud_face_type = 3
- $game_temp.hud_face_refresh = true
- end
- if @sp <= @actor.sp
- @sp_old = @actor.sp
- @sp = @actor.sp
- @sp_ref = 0
- if @actor.hp < @actor.maxhp * @low_hp / 100 and
- $game_temp.hud_face_type != 4
- $game_temp.hud_face_type = 4
- $game_temp.hud_face_time = 35
- elsif $game_temp.hud_face_type != 0
- $game_temp.hud_face_type = 0
- $game_temp.hud_face_time = 35
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * sp_number_refresh
- #--------------------------------------------------------------------------
- def sp_number_refresh
- @sp_number_sprite.bitmap.clear
- @s = @actor.sp * 100 / @actor.maxsp
- @sp_number_text = @sp.abs.to_s.split(//)
- for r in 0..@sp_number_text.size - 1
- @sp_number_abs = @sp_number_text[r].to_i
- if @actor.sp <= @actor.maxsp * @low_sp / 100
- @sp_src_rect = Rect.new(@sp_im_cw * @sp_number_abs, @sp_im_ch, @sp_im_cw, @sp_im_ch)
- else
- @sp_src_rect = Rect.new(@sp_im_cw * @sp_number_abs, 0, @sp_im_cw, @sp_im_ch)
- end
- @sp_number_bitmap.blt(20 + ((@sp_im_cw - 7) * r), 0, @sp_number_image, @sp_src_rect)
- end
- @sp_refresh = false if @sp == @actor.sp
- end
- #--------------------------------------------------------------------------
- # * Sp Flow Update
- #--------------------------------------------------------------------------
- def sp_flow_update
- @sp_sprite.bitmap.clear
- @sp_width = @sp_range * @actor.sp / @actor.maxsp
- #SP Damage---------------------------------
- if @sp_width_old != @sp_width
- valor = (@sp_width_old - @sp_width) * 3 / 100
- valor = 0.5 if valor < 1
- @sp_width_old -= valor if @sp_width_old > @sp_width
- if @sp_width_old < @sp_width
- @sp_width_old = @sp_width
- end
- @sp_src_rect_old = Rect.new(@sp_flow, @sp_height,@sp_width_old, @sp_height)
- @sp_bitmap.blt(0,0, @sp_image, @sp_src_rect_old)
- end
- #SP Real------------------------------------
- @sp_src_rect = Rect.new(@sp_flow, 0,@sp_width, @sp_height)
- @sp_bitmap.blt(0,0, @sp_image, @sp_src_rect)
- @sp_flow += 5
- if @sp_flow >= @sp_image.width - @sp_range
- @sp_flow = 0
- end
- end
- #--------------------------------------------------------------------------
- # * level_update
- #--------------------------------------------------------------------------
- def level_update
- @level_number_sprite.bitmap.clear
- @level_number_text = @actor.level.abs.to_s.split(//)
- for r in 0..@level_number_text.size - 1
- @level_number_abs = @level_number_text[r].to_i
- @level_src_rect = Rect.new(@level_im_cw * @level_number_abs, 0, @level_im_cw, @level_im_ch)
- @level_number_bitmap.blt(13 + ((@level_im_cw - 12) * r), 0, @level_number_image, @level_src_rect)
- end
- @level = @actor.level
- @level_number_sprite.zoom_x = 2
- @level_number_sprite.zoom_y = 2
- end
- #--------------------------------------------------------------------------
- # * level_update
- #--------------------------------------------------------------------------
- def level_up_effect
- @level_number_sprite.zoom_x -= 0.02
- @level_number_sprite.zoom_y -= 0.02
- if @level_number_sprite.zoom_x <= 1.00
- @level_number_sprite.zoom_x = 1.00
- @level_number_sprite.zoom_y = 1.00
- end
- end
- #--------------------------------------------------------------------------
- # * exp_update
- #--------------------------------------------------------------------------
- def exp_update
- @level_sprite.bitmap.clear
- if @actor.next_exp != 0
- rate = @actor.now_exp.to_f / @actor.next_exp
- else
- rate = 1
- end
- if @actor.level < 99
- @level_cw = @level_image.width * rate
- else
- @level_cw = @level_image.width
- end
- @level_src_rect_back = Rect.new(0, 0,@level_cw, @level_image.height)
- @level_bitmap.blt(0,0, @level_image, @level_src_rect_back)
- @exp = @actor.exp
- end
- end
- #===============================================================================
- # Scene_Map
- #===============================================================================
- class Scene_Map
- alias acthud_main main
- #--------------------------------------------------------------------------
- # Main
- #--------------------------------------------------------------------------
- def main
- @viewport = Viewport.new(0, 0, 640, 480)
- @viewport.z = 9999
- @acthud = Active_Hud.new(@viewport)
- acthud_main
- @acthud.dispose
- @acthud = nil
- @viewport.dispose
- @viewport = nil
- end
- #--------------------------------------------------------------------------
- # Update
- #--------------------------------------------------------------------------
- alias acthud_update update
- def update
- acthud_update
- @acthud.update
- end
- end
- $mog_rgss_active_hud = true
复制代码 |
|