赞 | 1 |
VIP | 0 |
好人卡 | 18 |
积分 | 1 |
经验 | 6526 |
最后登录 | 2013-7-5 |
在线时间 | 334 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 334 小时
- 注册时间
- 2011-10-21
- 帖子
- 413
|
本帖最后由 消失的三千 于 2012-3-28 18:12 编辑
skyjjwan 发表于 2012-3-28 06:14
看了你的回答 貌似有一点理解了 这么说的话是画面显示优先级的问题吗?
这貌似看导入Viewport的次序了
优先级可以通过修改z坐标来更改
没有仔细研究过KGC的脚本,所以解决方法不明= =
在这里推荐个比较美观而且可和横版通用的脚本(顺带说说,这貌似文不对题= =)- #==============================================================================
- # ★RGSS2
- # STR15_Enemy HP Gauge v1.1a
- # By star:http://strcatyou.u-abel.net/
- # Translated by Mr. Bubble
- #
- # ・Show HP gauge of enemies when hit.
- # ・You can hide a specified enemy's HP gauge by adding "HIDEHP" to
- # the enemy's Notes field in the Database.
- # ・Updated with a back attack fix by Moonlight. Use this version ONLY with the
- # ATB+SBS scripts.
- #------------------------------------------------------------------------------
- #==============================================================================
- # ★このスクリプトの機能を有効にする
- if true
- #==============================================================================
- # ■ Sprite_Battler
- #==============================================================================
- class Sprite_Battler < Sprite_Base
- # Word used in enemy Notes field to hide HP gauge
- GAUGE_M = "HIDEHP"
- # Gauge back color [Border color, Inside color]
- GAUGE_BC = [Color.new(0,0,0), Color.new(32,48,64)]
- # Color gradient [Left, Right]
- GAUGE_GC = [Color.new(64,128,96), Color.new(96,192,160)]
- #
- GAUGE_W = 70 # Gauge width
- GAUGE_H = 6 # Gauge height
- GAUGE_S = 8 # Gauge speed (more than 2)
- GAUGE_T = 640 # Gauge display length (more 510)
- GAUGE_O = 16 # Gauge opacity
- #
- GAUGE_V = false # STR cursor appears when damaged. Requires STRxx Cursor. # ※XP風バトルを導入してない場合は有効にしないでください
- #--------------------------------------------------------------------------
- # ● ゲージスプライト作成(追加)
- #--------------------------------------------------------------------------
- def create_enhpgauge
- g_width = GAUGE_W # 幅
- g_height = GAUGE_H # 高さ
- f_color = GAUGE_BC # ゲージバックカラー
- g_color = GAUGE_GC # ゲージカラー
- # ビットマップ作成
- bitmap = Bitmap.new(g_width, g_height * 2)
- # 上半分:ゲージバック
- bitmap.fill_rect(0, 0, g_width, g_height, f_color[0]) # 枠外
- bitmap.fill_rect(1, 1, g_width - 2, g_height - 2, f_color[1]) # 枠内
- # 下半分:グラデゲージ
- bitmap.gradient_fill_rect(1, g_height + 1, g_width - 2, g_height - 2,
- g_color[0], g_color[1]) # グラデ
- # スプライト作成 # [0] = ゲージバック; [1] = ゲージ
- @hp_gauge = [Sprite.new, Sprite.new]
- for i in 0..1
- sprite = @hp_gauge[i]
- sprite.viewport = self.viewport
- sprite.bitmap = bitmap
- sprite.src_rect.set(0, 0, g_width, g_height)
- sprite.src_rect.y = g_height if i == 1
- if $back_attack && N01::BACK_ATTACK && N01::BACK_ATTACK_NON_BACK_MIRROR
- sprite.x = Graphics.width - @battler.screen_x
- else
- sprite.x = @battler.screen_x
- end
- sprite.y = @battler.screen_y - 8
- sprite.ox = g_width / 2
- sprite.oy = g_height / 2
- sprite.z = 200
- sprite.z += 20 if i == 1
- sprite.opacity = 0
- end
- # いろいろ
- @enid = @battler.enemy_id
- @hp = @battler.hp
- @gauge_width = GAUGE_W + 1
- @gauge_opacity = 0
- end
- #--------------------------------------------------------------------------
- # ● ゲージ更新(追加)
- #--------------------------------------------------------------------------
- def enhpgauge_update
- # エネミーIDが変動していたらメモの内容を再取得・可視状態も更新
- if @enid != @battler.enemy_id
- @enid = @battler.enemy_id
- @gauge_visible = true
- @gauge_visible = false if $data_enemies[@enid].note.include?(GAUGE_M)
- for i in @hp_gauge do i.visible = @gauge_visible end
- end
- return unless @gauge_visible
- # ゲージ更新
- if @hp != @battler.hp
- g_width = (@battler.hp / (@battler.maxhp * 1.0))
- @gauge_width = ((GAUGE_W * g_width) + 1).truncate
- @gauge_opacity = GAUGE_T
- @hp = @battler.hp
- end
- # 幅
- g_width = @hp_gauge[1].src_rect.width
- speed = GAUGE_S
- rect = @hp_gauge[1].src_rect
- rect.width = (@gauge_width + (g_width * (speed - 1))) / speed
- if rect.width != @gauge_width
- if rect.width > @gauge_width
- rect.width -= 1
- else
- rect.width += 1
- end
- end
- rect.width = 2 if rect.width <= 1 and @hp > 0
- # 透明度
- if GAUGE_V and @battler.cursor_flash
- @gauge_opacity += GAUGE_O * 2 if @gauge_opacity <= GAUGE_T / 2
- else
- @gauge_opacity -= GAUGE_O if @gauge_opacity > 0
- end
- # 透明度適用
- for i in @hp_gauge do i.opacity = @gauge_opacity end
- end
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化(エイリアス)
- #--------------------------------------------------------------------------
- alias initialize_str15 initialize
- def initialize(viewport, battler = nil)
- initialize_str15(viewport, battler)
- if @battler.is_a?(Game_Enemy)
- create_enhpgauge
- @gauge_visible = true
- @gauge_visible = false if $data_enemies[@enid].note.include?(GAUGE_M)
- for i in @hp_gauge do i.visible = @gauge_visible end
- end
- end
- #--------------------------------------------------------------------------
- # ● 解放(エイリアス)
- #--------------------------------------------------------------------------
- alias dispose_str15 dispose
- def dispose
- dispose_str15
- if @battler.is_a?(Game_Enemy)
- @hp_gauge[0].bitmap.dispose
- @hp_gauge[0].dispose
- @hp_gauge[1].dispose
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新(エイリアス)
- #--------------------------------------------------------------------------
- alias update_str15 update
- def update
- update_str15
- enhpgauge_update if @battler.is_a?(Game_Enemy)
- end
- end
- #
- end
复制代码 |
|