赞 | 0 |
VIP | 10 |
好人卡 | 3 |
积分 | 1 |
经验 | 3584 |
最后登录 | 2015-10-25 |
在线时间 | 134 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 134 小时
- 注册时间
- 2009-3-29
- 帖子
- 470
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
好想以前有人发过了...
System:里
GaugeHP.png
GaugeMP.png
GaugeEXP.png
美丽血条显示
- #==============================================================================
- # ■ Window_Status
- #==============================================================================
- class Window_Status < Window_Base
- def draw_exp_info(x, y)
- s_next = sprintf(Vocab::ExpNext, Vocab::level)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal)
- self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next)
- draw_actor_exp(@actor, x, y + WLH * 1)
- draw_actor_next_exp(@actor, x, y + WLH * 3)
- end
- end
- module KGC
- module GenericGauge
- # 图像 >>> Graphics/System
- HP_IMAGE = "GaugeHP" # HP
- MP_IMAGE = "GaugeMP" # MP
- EXP_IMAGE = "GaugeEXP" # EXP
- # 位置坐标 [x, y]
- HP_OFFSET = [-23, -2] # HP
- MP_OFFSET = [-23, -2] # MP
- EXP_OFFSET = [-23, -2] # EXP
- # 长度
- HP_LENGTH = -4 # HP
- MP_LENGTH = -4 # MP
- EXP_LENGTH = -4 # EXP
- # 倾斜度
- # 数值指定:(-89~89)
- HP_SLOPE = 30 # HP
- MP_SLOPE = 30 # MP
- EXP_SLOPE = 30 # EXP
- end
- end
- #==============================================================================
- $imported = {} if $imported == nil
- $imported["GenericGauge"] = true
- #==============================================================================
- # ■ Bitmap
- #==============================================================================
- unless $imported["BitmapExtension"]
- class Bitmap
- #--------------------------------------------------------------------------
- # 倾斜...
- #--------------------------------------------------------------------------
- def skew_blt(x, y, src_bitmap, src_rect, slope, opacity = 255)
- slope = [[slope, -90].max, 90].min
- sh = src_rect.height
- off = sh / Math.tan(Math::PI * (90 - slope.abs) / 180.0)
- if slope >= 0
- dx = x + off.round
- diff = -off / sh
- else
- dx = x
- diff = off / sh
- end
- rect = Rect.new(src_rect.x, src_rect.y, src_rect.width, 1)
- sh.times { |i|
- blt(dx + (diff * i).round, y + i, src_bitmap, rect, opacity)
- rect.y += 1
- }
- end
- end
- end
-
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- def next_exp
- return @exp_list[@level+1]
- end
- def next_diff_exp
- return (@exp_list[@level+1] - @exp_list[@level])
- end
- def next_rest_exp
- return (@exp_list[@level+1] - @exp)
- end
- end
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_Base < Window
- GAUGE_SRC_POS = {
- :normal => [ 0, 24],
- :decrease => [ 0, 48],
- :increase => [72, 48],
- }
- @@__gauge_buf = Bitmap.new(320, 24)
- def draw_gauge(file, x, y, width, value, limit, offset, len_offset, slope,
- gauge_type = :normal)
- img = Cache.system(file)
- x += offset[0]
- y += offset[1]
- width += len_offset
- draw_gauge_base(img, x, y, width, slope)
- gw = width * value / limit
- draw_gauge_bar(img, x, y, width, gw, slope, GAUGE_SRC_POS[gauge_type])
- end
- def draw_gauge_base(img, x, y, width, slope)
- rect = Rect.new(0, 0, 24, 24)
- if slope != 0
- self.contents.skew_blt(x, y, img, rect, slope)
- rect.x = 96
- self.contents.skew_blt(x + width + 24, y, img, rect, slope)
- rect.x = 24
- rect.width = 72
- dest_rect = Rect.new(0, 0, width, 24)
- @@__gauge_buf.clear
- @@__gauge_buf.stretch_blt(dest_rect, img, rect)
- self.contents.skew_blt(x + 24, y, @@__gauge_buf, dest_rect, slope)
- else
- self.contents.blt(x, y, img, rect)
- rect.x = 96
- self.contents.blt(x + width + 24, y, img, rect)
- rect.x = 24
- rect.width = 72
- dest_rect = Rect.new(x + 24, y, width, 24)
- self.contents.stretch_blt(dest_rect, img, rect)
- end
- end
- def draw_gauge_bar(img, x, y, width, gw, slope, src_pos, start = 0)
- rect = Rect.new(src_pos[0], src_pos[1], 72, 24)
- dest_rect = Rect.new(0, 0, width, 24)
- @@__gauge_buf.clear
- @@__gauge_buf.stretch_blt(dest_rect, img, rect)
- dest_rect.x = start
- dest_rect.width = gw
- x += start
- if slope != 0
- self.contents.skew_blt(x + 24, y, @@__gauge_buf, dest_rect, slope)
- else
- self.contents.blt(x + 24, y, @@__gauge_buf, dest_rect)
- end
- end
- def draw_actor_hp_gauge(actor, x, y, width = 120)
- draw_gauge(KGC::GenericGauge::HP_IMAGE,
- x, y, width, actor.hp, actor.maxhp,
- KGC::GenericGauge::HP_OFFSET,
- KGC::GenericGauge::HP_LENGTH,
- KGC::GenericGauge::HP_SLOPE
- )
- end
- def draw_actor_mp_gauge(actor, x, y, width = 120)
- draw_gauge(KGC::GenericGauge::MP_IMAGE,
- x, y, width, actor.mp, [actor.maxmp, 1].max,
- KGC::GenericGauge::MP_OFFSET,
- KGC::GenericGauge::MP_LENGTH,
- KGC::GenericGauge::MP_SLOPE
- )
- end
- def draw_actor_exp(actor, x, y, width = 180)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y, width, WLH, actor.exp_s, 2)
- end
- def draw_actor_next_exp(actor, x, y, width = 180)
- draw_actor_exp_gauge(actor, x, y, width)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y, width, WLH, actor.next_rest_exp_s, 2)
- end
- def draw_actor_exp_gauge(actor, x, y, width = 180)
- diff = [actor.next_diff_exp, 1].max
- rest = [actor.next_rest_exp, 1].max
- draw_gauge(KGC::GenericGauge::EXP_IMAGE,
- x, y, width, diff - rest, diff,
- KGC::GenericGauge::EXP_OFFSET,
- KGC::GenericGauge::EXP_LENGTH,
- KGC::GenericGauge::EXP_SLOPE
- )
- end
- end
复制代码
地图血条显示:开关18打开时:
if $game_switches[18] == true
- class Scene_Map < Scene_Base
- alias hpmpwindow_start start
- def start
- hpmpwindow_start
- @hpmpwindow = Window_Base.new(395, 337, 160, 80)
- end
- alias hpmpwindow_update update
- def update
- actor = $game_party.members[0]
- if @temp_hp != actor.hp or @temp_mp != actor.mp
- @hpmpwindow.contents.clear
- @hpmpwindow.draw_actor_hp(actor, 0, 0)
- @hpmpwindow.draw_actor_mp(actor, 0, 25)
- @temp_hp = actor.hp
- @temp_mp = actor.mp
- end
- @hpmpwindow.update
- hpmpwindow_update
- if $game_switches[18] == true
- @hpmpwindow.opacity = 255
- @hpmpwindow.back_opacity = 255
- @hpmpwindow.contents_opacity = 255
- else
- @hpmpwindow.opacity = 0
- @hpmpwindow.back_opacity = 0
- @hpmpwindow.contents_opacity = 0
- end
- end
- alias hpmpwindow_terminate terminate
- def terminate
- @hpmpwindow.dispose
- hpmpwindow_terminate
- end
- end
复制代码
|
|