赞 | 0 |
VIP | 18 |
好人卡 | 0 |
积分 | 1 |
经验 | 1277 |
最后登录 | 2015-3-14 |
在线时间 | 11 小时 |
Lv1.梦旅人 空靈
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 11 小时
- 注册时间
- 2006-7-27
- 帖子
- 521
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
想讓HP、SP數值描繪在值槽上面。。而不是被蓋住。。
被蓋住的。。
下面是我的腳本。。-V-
- # ————————————————————————————————————
- # 本脚本来自www.66rpg.com,转载请保留此信息
- # ————————————————————————————————————
- #==============================================================================
- # ■ Game_Actor
- #------------------------------------------------------------------------------
- # 处理角色的类。本类在 Game_Actors 类 ($game_actors)
- # 的内部使用、Game_Party 类请参考 ($game_party) 。
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 取得战斗画面的 X 坐标
- #--------------------------------------------------------------------------
- def screen_x
- case self.index
- when 0
- return 350
- when 1
- return 430
- when 2
- return 510
- when 3
- return 580
- else
- return 600
- end
- end
- #--------------------------------------------------------------------------
- # ● 取得战斗画面的 Y 坐标
- #--------------------------------------------------------------------------
- def screen_y
- case self.index
- when 0
- return 430
- when 1
- return 395
- when 2
- return 360
- when 3
- return 325
- else
- return 1000
- end
- end
- #--------------------------------------------------------------------------
- # ● 取得战斗画面的 Z 坐标
- #--------------------------------------------------------------------------
- def screen_z
- case self.index
- when 0
- return 10
- when 1
- return 9
- when 2
- return 8
- when 3
- return 7
- else
- return 0
- end
- end
- end
-
- #==============================================================================
- # ■ Window_Base
- #------------------------------------------------------------------------------
- # 游戏中全部窗口的超级类。
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 描绘 HP
- # actor : 角色
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- # width : 描画目标的宽
- #--------------------------------------------------------------------------
- def draw_actor_hp1(actor, x, y, width = 72)
- # 描绘字符串 "HP"
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 24, 24, $data_system.words.hp)
- # 计算描绘 MaxHP 所需的空间
- if width - 24 >= 32
- hp_x = x + 32# + width - 24
- end
- # 描绘 HP
- self.contents.font.color = actor.hp == 0 ? knockout_color :
- actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
- self.contents.draw_text(hp_x, y, 32, 24, actor.hp.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● 描绘 SP
- # actor : 角色
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- # width : 描画目标的宽
- #--------------------------------------------------------------------------
- def draw_actor_sp1(actor, x, y, width = 72)
- # 描绘字符串 "SP"
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 24, 24, $data_system.words.sp)
- # 计算描绘 MaxSP 所需的空间
- if width - 24 >= 32
- sp_x = x + 32# + width - 24
- end
- # 描绘 SP
- self.contents.font.color = actor.sp == 0 ? knockout_color :
- actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
- self.contents.draw_text(sp_x, y, 32, 24, actor.sp.to_s, 2)
- end
- end
-
-
- #==============================================================================
- # ■ Window_BattleStatus
- #------------------------------------------------------------------------------
- # 显示战斗画面同伴状态的窗口。
- #==============================================================================
- class Window_BattleStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- #$data_system_level_up_me = "Audio/ME/升级音乐"
- def initialize
- super(0, 0, 640, 480)
- self.contents = Bitmap.new(width - 10, height - 32)
- self.opacity = 0
- @level_up_flags = [false, false, false, false]
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- super
- end
- #--------------------------------------------------------------------------
- # ● 设置升级标志
- # actor_index : 角色索引
- #--------------------------------------------------------------------------
- def level_up(actor_index)
- @level_up_flags[actor_index] = true
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @item_max = $game_party.actors.size
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
-
- x = i * 125
- a = actor.id.to_s + "_b"
- bitmap=Bitmap.new("Graphics/Battlersface/#{a}")
- src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- self.contents.blt(110 + x , 376, bitmap, src_rect)
-
- case i
- when 0
- x = 171
- y = 406
- when 1
- x = 296
- y = 406
- when 2
- x = 421
- y = 406
- when 3
- x = 546
- y = 406
- end
- if @level_up_flags[i]
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y, 80, 24, "修為提升!")
- Audio.me_stop
- Audio.me_play($data_system_level_up_me)
- else
- self.contents.font.size = 12
- draw_actor_hp1(actor, x-15, y-15, 80)
- self.contents.font.size = 12
- draw_actor_sp1(actor, x-15, y+5, 80)
- self.contents.font.size = 12
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- super
- # 主界面的不透明度下降
- if $game_temp.battle_main_phase
- self.contents_opacity -= 50 if self.contents_opacity > 1
- else
- self.contents_opacity += 50 if self.contents_opacity < 255
- end
- end
- end
-
-
- #==============================================================================
- # ■ Window_BattleStatus
- #==============================================================================
- class Window_BattleStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化
- #--------------------------------------------------------------------------
- alias xrxs_bp2_refresh refresh
- def refresh
- xrxs_bp2_refresh
- @item_max = $game_party.actors.size
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- case i
- when 0
- x = 169
- y = 394
- when 1
- x = 294
- y = 394
- when 2
- x = 419
- y = 394
- when 3
- x = 544
- y = 394
- end
- draw_actor_hp_meter(actor, x, y)
- draw_actor_sp_meter(actor, x, y + 19)
- end
- end
- end
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● HP描画
- #--------------------------------------------------------------------------
- def draw_actor_hp_meter(actor,x,y)
- width = 50
- white = Color.new(255,255,255,200)
- black = Color.new(0,0,0,200)
- startcolor = Color.new(255,0,0,200)
- endcolor = Color.new(255,255,0,200)
- w = width * actor.hp / actor.maxhp
- #白色边框
- self.contents.fill_rect(x+1, y+11, width-2, 1, white)
- self.contents.fill_rect(x, y+12, width, 1, white)
- self.contents.fill_rect(x-1, y+13, width+2, 9, white)
- self.contents.fill_rect(x, y+22, width, 1, white)
- self.contents.fill_rect(x+1, y+23, width-2, 1, white)
- #黑色背景
- self.contents.fill_rect(x+2, y+12, width-4, 1, black)
- self.contents.fill_rect(x+1, y+13, width-2, 1, black)
- self.contents.fill_rect(x, y+14, width, 7, black)
- self.contents.fill_rect(x+1, y+21, width-2, 1, black)
- self.contents.fill_rect(x+2, y+22, width-4, 1, black)
- if w > width/2
- draw_line(x+1, y+12, x+w-3, y+12, startcolor, 1, endcolor)
- draw_line(x, y+13, x+w-2, y+13, startcolor, 1, endcolor)
- draw_line(x-1, y+14, x+w-1, y+14, startcolor, 1, endcolor)
- draw_line(x-1, y+15, x+w-1, y+15, startcolor, 1, endcolor)
- draw_line(x-1, y+16, x+w-1, y+16, startcolor, 1, endcolor)
- draw_line(x-1, y+17, x+w-1, y+17, startcolor, 1, endcolor)
- draw_line(x-1, y+18, x+w-1, y+18, startcolor, 1, endcolor)
- draw_line(x-1, y+19, x+w-1, y+19, startcolor, 1, endcolor)
- draw_line(x-1, y+20, x+w-1, y+20, startcolor, 1, endcolor)
- draw_line(x, y+21, x+w-2, y+21, startcolor, 1, endcolor)
- draw_line(x+1, y+22, x+w-3, y+22, startcolor, 1, endcolor)
- else
- draw_line(x+1, y+12, x+w+2, y+12, startcolor, 1, endcolor)
- draw_line(x, y+13, x+w+1, y+13, startcolor, 1, endcolor)
- draw_line(x-1, y+14, x+w, y+14, startcolor, 1, endcolor)
- draw_line(x-1, y+15, x+w, y+15, startcolor, 1, endcolor)
- draw_line(x-1, y+16, x+w, y+16, startcolor, 1, endcolor)
- draw_line(x-1, y+17, x+w, y+17, startcolor, 1, endcolor)
- draw_line(x-1, y+18, x+w, y+18, startcolor, 1, endcolor)
- draw_line(x-1, y+19, x+w, y+19, startcolor, 1, endcolor)
- draw_line(x-1, y+20, x+w, y+20, startcolor, 1, endcolor)
- draw_line(x, y+21, x+w+1, y+21, startcolor, 1, endcolor)
- draw_line(x+1, y+22, x+w+2, y+22, startcolor, 1, endcolor)
- end
- end
- def draw_actor_sp_meter(actor,x,y)
- width = 50
- white = Color.new(255,255,255,200)
- black = Color.new(0,0,0,200)
- startcolor = Color.new(0,0,255,200)
- endcolor = Color.new(0,255,255,200)
- w = width * actor.sp / actor.maxsp
- #白色边框
- self.contents.fill_rect(x+1, y+11, width-2, 1, white)
- self.contents.fill_rect(x, y+12, width, 1, white)
- self.contents.fill_rect(x-1, y+13, width+2, 9, white)
- self.contents.fill_rect(x, y+22, width, 1, white)
- self.contents.fill_rect(x+1, y+23, width-2, 1, white)
- #黑色背景
- self.contents.fill_rect(x+2, y+12, width-4, 1, black)
- self.contents.fill_rect(x+1, y+13, width-2, 1, black)
- self.contents.fill_rect(x, y+14, width, 7, black)
- self.contents.fill_rect(x+1, y+21, width-2, 1, black)
- self.contents.fill_rect(x+2, y+22, width-4, 1, black)
- if w > width/2
- draw_line(x+1, y+12, x+w-3, y+12, startcolor, 1, endcolor)
- draw_line(x, y+13, x+w-2, y+13, startcolor, 1, endcolor)
- draw_line(x-1, y+14, x+w-1, y+14, startcolor, 1, endcolor)
- draw_line(x-1, y+15, x+w-1, y+15, startcolor, 1, endcolor)
- draw_line(x-1, y+16, x+w-1, y+16, startcolor, 1, endcolor)
- draw_line(x-1, y+17, x+w-1, y+17, startcolor, 1, endcolor)
- draw_line(x-1, y+18, x+w-1, y+18, startcolor, 1, endcolor)
- draw_line(x-1, y+19, x+w-1, y+19, startcolor, 1, endcolor)
- draw_line(x-1, y+20, x+w-1, y+20, startcolor, 1, endcolor)
- draw_line(x, y+21, x+w-2, y+21, startcolor, 1, endcolor)
- draw_line(x+1, y+22, x+w-3, y+22, startcolor, 1, endcolor)
- else
- draw_line(x+1, y+12, x+w+1, y+12, startcolor, 1, endcolor)
- draw_line(x, y+13, x+w, y+13, startcolor, 1, endcolor)
- draw_line(x-1, y+14, x+w-1, y+14, startcolor, 1, endcolor)
- draw_line(x-1, y+15, x+w-1, y+15, startcolor, 1, endcolor)
- draw_line(x-1, y+16, x+w-1, y+16, startcolor, 1, endcolor)
- draw_line(x-1, y+17, x+w-1, y+17, startcolor, 1, endcolor)
- draw_line(x-1, y+18, x+w-1, y+18, startcolor, 1, endcolor)
- draw_line(x-1, y+19, x+w-1, y+19, startcolor, 1, endcolor)
- draw_line(x-1, y+20, x+w-1, y+20, startcolor, 1, endcolor)
- draw_line(x, y+21, x+w, y+21, startcolor, 1, endcolor)
- draw_line(x+1, y+22, x+w+1, y+22, startcolor, 1, endcolor)
- end
- end
- #--------------------------------------------------------------------------
- # ● ライン描画 by 桜雅 在土
- #--------------------------------------------------------------------------
- def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
- # 描写距離の計算。大きめに直角時の長さ。
- distance = (start_x - end_x).abs + (start_y - end_y).abs
- # 描写開始
- if end_color == start_color
- for i in 1..distance
- x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
- y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
- if width == 1
- self.contents.set_pixel(x, y, start_color)
- else
- self.contents.fill_rect(x, y, width, width, start_color)
- end
- end
- else
- for i in 1..distance
- x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
- y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
- r = start_color.red * (distance-i)/distance + end_color.red * i/distance
- g = start_color.green * (distance-i)/distance + end_color.green * i/distance
- b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
- a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
- if width == 1
- self.contents.set_pixel(x, y, Color.new(r, g, b, a))
- else
- self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
- end
- end
- end
- end
- end
复制代码
版务信息:本贴由楼主自主结贴~ |
|