赞 | 0 |
VIP | 37 |
好人卡 | 2 |
积分 | 1 |
经验 | 37031 |
最后登录 | 2024-10-24 |
在线时间 | 1422 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 117
- 在线时间
- 1422 小时
- 注册时间
- 2008-8-30
- 帖子
- 999
|
3楼
楼主 |
发表于 2012-8-27 18:28:32
|
只看该作者
泉之精灵 发表于 2012-8-27 13:01
修改完毕,现在需要的是和怪兽、角色的战斗图相同的文件名的图标,然后这些图标都是放在Pictures文件夹里
... - #==============================================================================
- # ■ Window_Cp_Bar
- #==============================================================================
- class Window_Cp_Bar < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 640, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- setup_battlers
- self.z -= 70
- @viewport = Viewport.new(0,0,640,480)
- @viewport.z = self.z + 10
- @sprite_cp_bar = Sprite.new(@viewport)
- @sprite_cp_bar.bitmap = RPG::Cache.picture("Cp_Bar.png")
- @sprite_cp_bar.z = self.z + 10
- @sprite_cp_bar.x = 370
- @sprite_cp_bar.y = 20
- @sprites = []
- 12.times{@sprites.push(RPG::Sprite.new(@viewport))}
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 获取战斗者
- #--------------------------------------------------------------------------
- def setup_battlers
- @actors = $game_party.actors
- @enemies = $game_troop.enemies
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- super
- @sprite_cp_bar.bitmap.dispose
- @sprite_cp_bar.dispose
- return if @sprites.size == 0
- for sprite in @sprites
- sprite.dispose
- end
- @viewport.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def update
- super
- @viewport.update
- for sprite in @sprites
- sprite.update
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘
- #--------------------------------------------------------------------------
- def refresh(now_maxspeed = 999)
- for i in 0...4
- actor = @actors[i]
- if actor.nil?
- if @sprites[i].bitmap != nil
- @sprites[i].bitmap.dispose
- @sprites[i].bitmap = nil
- end
- @sprites[i].visible = false
- next
- end
- battler_name = actor.battler_name
- battler_hue = actor.battler_hue
- @sprites[i].bitmap = RPG::Cache.picture(battler_name, battler_hue)
- @sprites[i].ox = @sprites[i].bitmap.width / 2
- @sprites[i].oy = @sprites[i].bitmap.height
- cp = [now_maxspeed, actor.cp].min
- cp_x = (cp.to_f / now_maxspeed) * 182.0
- cp_x = Integer(cp_x)
- @sprites[i].x = cp_x + 405
- @sprites[i].y = 38
- @sprites[i].z = cp
- if actor.dead? or actor.hidden
- @sprites[i].visible = false
- else
- @sprites[i].visible = true
- end
- end
- for i in 4...12
- enemy = @enemies[i - 4]
- if enemy.nil?
- if @sprites[i].bitmap != nil
- @sprites[i].bitmap.dispose
- @sprites[i].bitmap = nil
- end
- @sprites[i].visible = false
- next
- end
- battler_name = enemy.battler_name
- battler_hue = enemy.battler_hue
- @sprites[i].bitmap = RPG::Cache.battler(battler_name, battler_hue)
- @sprites[i].zoom_x = (24.0 / @sprites[i].bitmap.width)
- @sprites[i].zoom_y = (24.0 / @sprites[i].bitmap.height)
- @sprites[i].ox = @sprites[i].bitmap.width / 2
- @sprites[i].oy = 0
- cp = [now_maxspeed, enemy.cp].min
- cp_x = (cp.to_f / now_maxspeed) * 182.0
- cp_x = Integer(cp_x)
- @sprites[i].x = cp_x + 405
- @sprites[i].y = 50
- @sprites[i].z = cp
- if enemy.dead? or enemy.hidden
- @sprites[i].visible = false
- else
- @sprites[i].visible = true
- end
- end
- end
- end
复制代码 72行出错了 |
|