先放截图 
我的思路仅供参考。
 再次更新,这次测试没发现问题。。
其余问题: 
1. fill_rect过多 
2. 敌人CP没有显示 
等 
太赖暂时不考虑修正 。。
 
工程
 
CP 
RUBY 代码 - #------------------------------------------------------------------------------
 - # - CP战斗
 - #------------------------------------------------------------------------------
 - #------------------------------------------------------------------------------
 - # - 设置
 - #------------------------------------------------------------------------------
 - module CP
 -   Speed = 1                                # 速度
 -   Width = 120                              # CP条宽度
 -   Height = 6                               # CP条高度
 -   Back_Color = Color.new(0, 0, 0)          # CP条背景色
 -   Cp_Color = Color.new(255, 255, 64)       # CP条填充色
 -   Cp_Color_2 = Color.new(255, 128, 255)    # CP条填充色(满)
 - end
 - #------------------------------------------------------------------------------
 - # - 战斗者CP属性
 - #------------------------------------------------------------------------------
 - class Game_Battler
 -   attr_accessor :cp, :cp_speed
 -   alias initialize_cp_old initialize
 -   def initialize
 -     @cp = 0
 -     @cp_speed = 0
 -     initialize_cp_old
 -   end
 - end
 - #------------------------------------------------------------------------------
 - # - 战斗场景
 - #------------------------------------------------------------------------------
 - class Scene_Battle
 -   #----------------------------------------------------------------------------
 -   # - 主方法
 -   #----------------------------------------------------------------------------
 -   alias main_cp_old main
 -   def main
 -     @cp_viewport = Viewport.new(0, 465, 640, CP::Height)
 -     @cp_viewport.z = 9999
 -     @cp_sprite = Sprite.new(@cp_viewport)
 -     @cp_sprite.bitmap = Bitmap.new(640, CP::Height)
 -     cp_bar
 -     main_cp_old
 -     @cp_sprite.bitmap.dispose
 -     @cp_sprite.dispose
 -     @cp_viewport.dispose
 -   end
 -   #--------------------------------------------------------------------------
 -   # - 速度
 -   #--------------------------------------------------------------------------
 -   def cp_speed
 -     battlers_agi = []
 -     for battler in$game_party.actors + $game_troop.enemies
 -       battlers_agi = width - 1
 -         cp_color = CP::Cp_Color_2
 -         wid = width - 1
 -       else
 -         cp_color = CP::Cp_Color
 -         wid = actor.cp
 -       end
 -       @cp_sprite.bitmap.fill_rect(x + 1, 1, wid, height - 2, cp_color)
 -     end
 -   end
 - end
 - class Scene_Battle
 -   alias start_phase2_cp_old start_phase2
 -   def start_phase2
 -     cp_bar
 -     start_phase2_cp_old
 -   end
 -   def make_action_orders
 -     @action_battlers = [@active_battler_cp]
 -   end
 -   alias update_phase4_step6_cp_old update_phase4_step6
 -   def update_phase4_step6
 -     update_phase4_step6_cp_old
 -     @active_battler.cp = 0
 -   end
 - end
 
  复制代码 
Scene_Battle 3 
RUBY 代码 
             本帖来自P1论坛作者恐惧剑刃,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址: https://rpg.blue/forum.php?mod=viewthread&tid=373412  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。  |