赞 | 5 |
VIP | 620 |
好人卡 | 38 |
积分 | 69 |
经验 | 125468 |
最后登录 | 2015-7-27 |
在线时间 | 1666 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 6855
- 在线时间
- 1666 小时
- 注册时间
- 2008-10-29
- 帖子
- 6710
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 后知后觉 于 2009-12-7 16:51 编辑
这个版本只是单纯的把VX的【可视化战斗选择框】移植过来
可视化战斗选择框作者:柳柳
http://rpg.blue/viewthread.php?tid=71904&page=1
还用到了一个模拟RGSS2 Bitmap的XPBitmap脚本
作者:猫哥哥
http://rpg.blue/viewthread.php?t ... 2D6%2D7+1%3A32%3A11
可视化战斗选择框v1.1
可视化选择框v1.1.rar
(681.11 KB, 下载次数: 458)
使用时候首先下载以下图:
命名为enemy_select_back.png放在Graphics/pictures目录下
这个效果基本上在默认这种纵板的战斗板式上不太好
选择框的大小是根据战斗图的尺寸来计算的
现在的算法只合适默认的这种静态战斗图.全动画战斗应该也可以用
但是不适合超级战斗方式做出来的动态战斗
关于这一点就需要你自己动手改改了
如果想要选择框的大小固定的话需要自己改数据
如果想加大选择框的大小又不会脚本的话.可以用图片处理工具.比如Photoshop
把战斗图的画布向4方位扩展.让可见区域和图片边缘留出透明区域多一点即可
完整脚本如下:(包含猫哥哥的bitmap部分)
- #==============================================================================
- # ■ 本脚本来自 www.66rpg.com 使用或转载时请保留此信息.谢谢!
- #==============================================================================
- #==============================================================================
- # ■ 可视化战斗选择框
- # 原作者:柳柳 (VX平台)
- # 移植 :后知后觉(HZHJ)
- # 版本 :v1.1
- # 使用说明:整段脚本插入到 Main 前
- # Graphics/pictures 目录下有一张图片 一起拷贝到自己工程去
- # 切记这张图片不要改名 原来名字为 enemy_select_back.png
- # 这图为圆形.可以根据你的喜好改成五角星.方框.桃心等诡异形状
- # 本脚本还使用到 猫哥哥 的 RGSS2_bitmap_xp
- # 用到了里面的 clear_rect,blur,blur_r
- # 这个脚本的其他功能因为本脚本未使用.所以用 =begin~=end 进行了块注释
- #==============================================================================
- #==============================================================================
- # ■ Scene_Battle (分割定义 1)
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● 刷新画面画面 (角色命令回合 : 选择敌人)
- #--------------------------------------------------------------------------
- alias hzhj_update_select_enemy update_phase3_enemy_select
- def update_phase3_enemy_select
- hzhj_update_select_enemy
- if @enemy_arrow != nil and @hzhj_select_enemy != @enemy_arrow.index
- @hzhj_select_enemy = @enemy_arrow.index
- update_target_select_sprite($game_troop.enemies[@enemy_arrow.index])
- end
- end
- #--------------------------------------------------------------------------
- # ● 画面更新 (角色指令回合 : 选择角色)
- #--------------------------------------------------------------------------
- alias hzhj_update_select_actor update_phase3_actor_select
- def update_phase3_actor_select
- hzhj_update_select_actor
- if @actor_arrow != nil and @hzhj_select_actor != @actor_arrow.index
- @hzhj_select_actor = @actor_arrow.index
- update_target_select_sprite($game_party.actors[@actor_arrow.index])
- end
- end
- #--------------------------------------------------------------------------
- # ● 开始选择敌人
- #--------------------------------------------------------------------------
- alias hzhj_start_enemy_select start_enemy_select
- def start_enemy_select
- hzhj_start_enemy_select
- @enemy_arrow.visible = false
- @target_select_sprite = Sprite.new
- @target_select_sprite.z = 9999
- @target_select_sprite.bitmap = Bitmap.new(640, 480)
- @target_select_sprite.opacity = 160
- @hzhj_select_enemy = 9999
- end
- #--------------------------------------------------------------------------
- # ● 结束选择敌人
- #--------------------------------------------------------------------------
- alias hzhj_end_enemy_select end_enemy_select
- def end_enemy_select
- hzhj_end_enemy_select
- @target_select_sprite.bitmap.dispose
- @target_select_sprite.dispose
- @target_select_sprite = nil
- @hzhj_select_enemy = 9999
- end
- #--------------------------------------------------------------------------
- # ● 开始选择角色
- #--------------------------------------------------------------------------
- alias hzhj_start_actor_select start_actor_select
- def start_actor_select
- hzhj_start_actor_select
- @actor_arrow.visible = false
- @target_select_sprite = Sprite.new
- @target_select_sprite.z = 9999
- @target_select_sprite.bitmap = Bitmap.new(640, 480)
- @target_select_sprite.opacity = 160
- @hzhj_select_actor = 9999
- end
- #--------------------------------------------------------------------------
- # ● 结束选择角色
- #--------------------------------------------------------------------------
- alias hzhj_end_actor_select end_actor_select
- def end_actor_select
- hzhj_end_actor_select
- @target_select_sprite.bitmap.dispose
- @target_select_sprite.dispose
- @target_select_sprite = nil
- @hzhj_select_actor = 9999
- end
- #★★★★★★★★★★★★★★★★★★★★★★★★★
- #--------------------------------------------------------------------------
- # ● 刷新画面 战斗可视化选择框
- #--------------------------------------------------------------------------
- def update_target_select_sprite(enemy)
- @target_select_sprite.bitmap.clear
- @target_select_sprite.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 255))
- enemy_bmp = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
- enemy_x = enemy.screen_x
- enemy_y = enemy.screen_y
- hzhj_x = enemy_x - enemy_bmp.width / 2
- hzhj_y = enemy_y - enemy_bmp.height
- if enemy_bmp.width < enemy_bmp.height
- hzhj_wh = enemy_bmp.height
- hzhj_x = hzhj_x - (enemy_bmp.height - enemy_bmp.width) / 2
- elsif enemy_bmp.width > enemy_bmp.height
- hzhj_wh = enemy_bmp.width
- hzhj_y = hzhj_y - (enemy_bmp.width - enemy_bmp.height) / 2
- else
- hzhj_wh = enemy_bmp.width
- end
- dest_rect = Rect.new(hzhj_x,hzhj_y,hzhj_wh,hzhj_wh)
- src_bitmap = RPG::Cache.picture("enemy_select_back")
- src_rect = src_bitmap.rect
- @target_select_sprite.bitmap.clear_rect(dest_rect)
- @target_select_sprite.bitmap.stretch_blt(dest_rect, src_bitmap, src_rect)
- @target_select_sprite.bitmap.blur
- @target_select_sprite.bitmap.blur
- end
- #▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
- end
- #=============================================================================#
- # #
- # ●RGSS2_bitmap_xp ver 1.02 #
- # #
- # by 猫哥哥 [email protected] # # # #
- #=============================================================================#
- # #
- #Logs: #
- # ※ 模拟了RGSS2的blur,gradient_fill_rect,clear_rect,并为各个方法增 #
- # 加了新的功能。 #
- # ※ 另赠送fragment_blur,fragment_bluring,blur_r,glass_fill_rect几个 #
- # 方法。 #
- # ※ 模拟RGSS2给draw_text,text_size增加了一点RGSS2的内容。 #
- # ※ radial_blur不做了,嫌麻烦=_= #
- # ※ 优化了某个临时的bitmap没有释放的问题。 #
- # ※ 因为某些原因,应该不会再更新了。转载请保留说明内容。 #
- # #
- #=============================================================================#
- class Bitmap
- =begin
- def gradient_fill_rect(x, y, width, height, color1, color2,vertical = false,opacity = 255)
- #gradient_fill_rect(x坐标,y坐标,矩形宽,矩形高,颜色1,颜色2,横(竖)填充,不透明度)
- vertical == false ? step = width - x : step = height - y;color = color1;color.alpha = opacity
- key_re = Math.sqrt(((color2.red - color1.red)/step)**2);key_gr = Math.sqrt(((color2.green - color1.green)/step)**2);key_bl = Math.sqrt(((color2.blue - color1.blue)/step)**2)
- color2.red-color1.red>0 ? key_re=key_re : key_re= -key_re;color2.green-color1.green>0 ? key_gr=key_gr : key_gr= -key_gr;color2.blue-color1.blue>0 ? key_bl=key_bl : key_bl= -key_bl
-
- if vertical == true
- for i in y..height
- self.fill_rect(x, y, width, 1, color)
- y=y+1;color.red =color.red + key_re;color.green =color.green + key_gr;color.blue =color.blue + key_bl
- end
- else
- for i in x..width
- self.fill_rect(x, y, 1, height, color)
- x=x+1;color.red =color.red + key_re;color.green =color.green + key_gr;color.blue =color.blue + key_bl
- end
- end
- end
- #-------------------------------------------------------------------------------
- def fragment_blur(radius=6)
- #fragment_blur(分散半径)
- src_bitmap = self;rect = self.rect;key = 255/7
- self.blt(0,0,src_bitmap,rect,key*4)
- self.blt(0,-radius,src_bitmap,rect,key*2)
- self.blt(radius,0,src_bitmap,rect,key*2)
- self.blt(-radius,0,src_bitmap,rect,key*2)
- self.blt(0,radius,src_bitmap,rect,key*2)
- self.blt(radius,-radius,src_bitmap,rect,key*1)
- self.blt(-radius,radius,src_bitmap,rect,key*1)
- self.blt(-radius,-radius,src_bitmap,rect,key*1)
- self.blt(radius,radius,src_bitmap,rect,key*1)
- end
- #-------------------------------------------------------------------------------
- def fragment_bluring(blur=4,during=3)
- #fragment_bluring(重做模糊次数,经历帧数)
- src_bitmap = self
- for i in 1..blur
- src_bitmap.fragment_blur(i)
- self.blt(0, 0, src_bitmap, self.rect)
- for j in 1..during
- Graphics.update
- end
- end
-
- end
- =end
- #-------------------------------------------------------------------------------
- def blur(times=1,during =1,blur=1)
- #blur(重做模糊次数,经历帧数,分散半径)
- for i in 1..times
- blur_r(blur)
- for j in 1..during
- Graphics.update if i > 1 and during >1
- end
- end
- end
- #-------------------------------------------------------------------------------
- def blur_r(radius = 2)
- #blur_r(分散半径)
- radius = 1 if radius <= 1 or radius == nil #值的修正
- src_bitmap = self
- rect = self.rect
-
- ta_l = 1+radius*2
- ta = Table.new(ta_l,ta_l) #过滤器
- for i in 0..ta_l-1
- for j in 0..ta_l-1
- ta[i,j] = 1
- end
- end
- ta[((ta.xsize+1)/2)-1,((ta.xsize+1)/2)-1] = 2**(1+radius)
- main = ta[((ta.xsize+1)/2)-1,((ta.xsize+1)/2)-1]#找到中心点
- nn = 2;j = ((ta.xsize+1)/2)-1;line =[]#主干道
- for i in 0..((ta.xsize+1)/2)-2
- ta[i,j] = nn
- ta[j,i] = nn
- ta[ta.xsize-1-i,j] = nn
- ta[j,ta.xsize-1-i] = nn
- line.push ta[i,((ta.xsize+1)/2)-1]
- nn = nn * 2
- end
-
- for j in 0..line.size-1
- for i in 0..((ta.xsize+1)/2)-2
- line[j] = line[j]/2
- if line[j] == 1
- break
- else
- ta[((ta.xsize+1)/2)-2-i,j] = line[j]
- ta[((ta.xsize+1)/2)+i,j] = line[j]
- ta[((ta.xsize+1)/2)-2-i,ta.xsize-1-j] = line[j]
- ta[((ta.xsize+1)/2)+i,ta.xsize-1-j] = line[j]
- end
- end
- end
- key_a = [];key_p = main
- for i in 1..main
- if key_p == 1
- key_a.push main
- break
- else
- key_p = key_p/2
- key_a.push key_p
- end
- end
- key_k = 0
- for i in 0..key_a.size-1
- key_k = key_k + key_a[i]
- end
- key = 255/key_k
- key = 1 if key <= 0 #值的修正
- for i in 0..ta.xsize-1
- for j in 0..ta.ysize-1
- key_main = key*ta[i,j]
- key_main = 255 if key_main > 255 ; key_main = 1 if key_main < 0 #值的修正
- self.blt(i-(((ta.xsize+1)/2)-1),j-(((ta.xsize+1)/2)-1),src_bitmap,rect,key_main)
- end
- end
- end
- =begin
- #-------------------------------------------------------------------------------
- def glass_fill_rect(x, y, width, height, color1, color2,vertical = false)
- #glass_fill_rect(x坐标,y坐标,矩形宽,矩形高,颜色1,颜色2,横(竖)向填充)
- a1 = Bitmap.new(width, height);a2 = Bitmap.new(width, height)
- a1.fill_rect(x, y, width, height, color1);a2.fill_rect(x, y, width, height, color2)
- if vertical == false
- key =255/( width - x); key = 255 if key > 255;key = 1 if key < 1
-
- src_rect = Rect.new(x,y,1,height);k = x
- for i in x..width
- self.blt(x, y, a1, src_rect, (width-i)*key)
- self.blt(x, y, a2, src_rect, (i-k)*key)
- x = x+1
- end
- else
- key =255/( height - y);key = 255 if key > 255;key = 1 if key < 1
-
- src_rect = Rect.new(x,y,width,1);k = y
- for i in y..height
- self.blt(x, y, a1, src_rect, (height-i)*key)
- self.blt(x, y, a2, src_rect, (i-k)*key)
- y = y+1
- end
- end
- a1.dispose;a2.dispose
- end
- =end
- #-------------------------------------------------------------------------------
- def clear_rect(x, y, width, height)
- #clear_rect(x坐标, y坐标, 矩形宽, 矩形高)
- src_bitmap = Bitmap.new(self.width,self.height)
- rect_1 = Rect.new(0,0,self.width,y);rect_2 = Rect.new(0,y,x,height)
- rect_3 = Rect.new(x+width,y,self.width-(x+width),height);rect_4 = Rect.new(0,y+height,self.width,self.height-(y+height))
- src_bitmap.stretch_blt(rect_1, self, rect_1);src_bitmap.stretch_blt(rect_2, self, rect_2)
- src_bitmap.stretch_blt(rect_3, self, rect_3);src_bitmap.stretch_blt(rect_4, self, rect_4)
- self.clear;self.blt(0,0,src_bitmap,src_bitmap.rect)
- src_bitmap.dispose
- end
- =begin
- #-------------------------------------------------------------------------------
- #以下都是重定义的部分
- alias :bsucat_text_size :text_size
- def text_size(str)
- if str.instance_of?(String) == false
- str=str.to_s
- end
- bsucat_text_size(str)
- end
-
- alias :bsucat_draw_text :draw_text
- def draw_text(x, y, width=0, height=0, str="", align=0)
- # if x.instance_of?(Rect)
- if x.is_a?(Rect)
- # if y.is_a?(String) == false
- # y=y.to_s
- # end
- bsucat_draw_text(x.x, x.y, x.width, x.height, y, align=0)
- else
- if str.instance_of?(String) == false
- str=str.to_s
- end
- bsucat_draw_text(x, y, width, height, str, align=0)
- end
- end
-
-
- alias :bsucat_glass_fill_rect :glass_fill_rect
- def glass_fill_rect(x, y, width, height=false, color1=nil, color2=nil,vertical = false)
- if x.instance_of?(Rect) == true
- bsucat_glass_fill_rect(x.x, x.y, x.width, x.height, y, width,height)
- else
- bsucat_glass_fill_rect(x, y, width, height, color1, color2,vertical = false)
- end
- end
-
- alias :bsucat_gradient_fill_rect :gradient_fill_rect
- def gradient_fill_rect(x, y, width, height=false, color1 = 255, color2=nil,vertical = false,opacity = 255)
- if x.instance_of?(Rect)
- bsucat_gradient_fill_rect(x.x, x.y, x.width, x.height, y, width,height,color1)
- else
- bsucat_gradient_fill_rect(x, y, width, height, color1, color2,vertical = false,opacity = 255)
- end
- end
- =end
- alias :bsucat_clear_rect :clear_rect
- def clear_rect(x, y=nil, width=nil, height=nil)
- if x.instance_of?(Rect)
- bsucat_clear_rect(x.x, x.y, x.width, x.height)
- else
- bsucat_clear_rect(x, y, width, height)
- end
- end
- end
- #==============================================================================
- # ■ 本脚本来自 www.66rpg.com 使用或转载时请保留此信息.谢谢!
- #==============================================================================
复制代码 09-12-7更新
把椭圆换成了圆形
脚本中的一些东西换成了 alias 语句减少冲突 |
|