Project1
标题:
【简单问题】请问人物放大脚本如何和动态模糊脚本兼容
[打印本页]
作者:
duanmusu88
时间:
2012-1-8 17:20
标题:
【简单问题】请问人物放大脚本如何和动态模糊脚本兼容
#--------------------------------------------------------------------------
# ● 动态糊模效果
# 制作者 小飞侠_shoed
# 用法:
# 打开
# 开关[模糊效果]=ON
# 开关[模糊效果]=OFF
$模糊效果 = 1
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
alias plan_map_window_main main
def main
@blur_window = Blur_Effect.new
@blur_window.visible=$game_switches[$模糊效果]
plan_map_window_main
@blur_window.dispose
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
alias plan_map_window_update update
def update
plan_map_window_update
@blur_window.visible=$game_switches[$模糊效果]
@blur_window.update
end
#--------------------------------------------------------------------------
# ● 场所移动的变化
#--------------------------------------------------------------------------
alias plan_map_window_transfer_player transfer_player
def transfer_player
visible = $game_switches[$模糊效果]
$game_switches[$模糊效果] = false
@blur_window.visible=$game_switches[$模糊效果]
plan_map_window_transfer_player
@blur_window.dispose
@blur_window = Blur_Effect.new
$game_switches[$模糊效果] = visible
@blur_window.visible=$game_switches[$模糊效果]
end
end
#==============================================================================
# Blur_Effect
#==============================================================================
class Blur_Effect
def initialize
@blurSprite=Sprite.new
@sum=Bitmap.new(640,480)
@RT=Picture_Map.new
@blurSprite.bitmap=@sum
@blurSprite.z=9999
end
def update
if $game_switches[$模糊效果] == true
@RT.update
@sum.blt(0,0,@RT,Rect.new(0,0,@RT.width,@RT.height),60)
end
end
def dispose
@sum.dispose
@RT.dispose
@blurSprite.dispose
end
def visible=(flag)
@blurSprite.visible=flag
end
end
#==============================================================================
# Picture_Character
#==============================================================================
class Picture_Character < Bitmap
attr_accessor :character # 角色
def initialize(character = nil)
@character = character
@bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = @bitmap.width / 4
@ch = @bitmap.height / 4
super(@cw,@ch)
@stopTitles=[]
@moveTitles=[]
end
def update
self.clear
# 元件 ID、文件名、色相与现在的情况存在差异的情况下
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
# 记忆元件 ID 与文件名、色相
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
# 元件 ID 为有效值的情况下
if @tile_id >= 384
@bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
@cw = 32
@ch = 32
else
@bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
end
end
# 图形是角色的情况下
if @tile_id == 0
# 设置传送目标的矩形
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.blt(0,0,@bitmap,Rect.new(sx,sy,@cw,@ch))
end
#计算title
if self.visible
if @x != self.x or @y != self.y
@x=self.x
@y=self.y
@stopTitles.clear
#@moveTitles.clear
tile_x=self.real_width/32
if tile_x%2==0
tile_x+=1
end
tile_y=(self.real_height/32.0).ceil
for j in 0...tile_y
maskId=[self.x,self.y-j,j]
@stopTitles.push(maskId)
for i in 1..(tile_x-1)/2
maskId=[self.x-i,self.y-j,j]
@stopTitles.push(maskId)
maskId=[self.x+i,self.y-j,j]
@stopTitles.push(maskId)
end
end
@
[email protected]
case @character.direction
when 2 #向下
maskId=[self.x,self.y-tile_y,tile_y]
@moveTitles.push(maskId)
for i in 1..(tile_x-1)/2
maskId=[self.x-i,self.y-tile_y,tile_y]
@moveTitles.push(maskId)
maskId=[self.x+i,self.y-tile_y,tile_y]
@moveTitles.push(maskId)
end
when 4 #向左
for j in 0...tile_y
maskId=[self.x+(tile_x-1)/2+1,self.y-j,j]
@moveTitles.push(maskId)
end
when 6 #向右
for j in 0...tile_y
maskId=[self.x-(tile_x-1)/2-1,self.y-j,j]
@moveTitles.push(maskId)
end
when 8 #向上
for k in @moveTitles
k[2]+=1
end
maskId=[self.x,self.y+1,0]
@moveTitles.push(maskId)
for i in 1..(tile_x-1)/2
maskId=[self.x-i,self.y+1,0]
@moveTitles.push(maskId)
maskId=[self.x+i,self.y+1,0]
@moveTitles.push(maskId)
end
end
end
end
end
def x
return @character.x
end
def y
return @character.y
end
def screen_x
return @character.screen_x
end
def screen_y
return @character.screen_y
end
def screen_z
return @character.screen_z(@ch)
end
def real_width
return @cw
end
def real_height
return @ch
end
def visible
return
[email protected]
end
def opacity
return @character.opacity
end
def maskTitles
if @character.moving?
return @moveTitles
else
return @stopTitles
end
end
end
#==============================================================================
# Picture_Map
#==============================================================================
class Picture_Map < Bitmap
def initialize
super(640,480)
@map_cw = $game_map.width * 32
@map_ch = $game_map.height * 32
@tileset = RPG::Cache.tileset($game_map.tileset_name)
@autotiles = []
for i in 0..6
autotile_name = $game_map.autotile_names[i]
@autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@map_data = $game_map.data
@priorities = $game_map.priorities
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Picture_Character.new($game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Picture_Character.new($game_player))
@all_map = Bitmap.new (@map_cw,@map_ch)
make_map
end
def update
self.clear
self.blt(0,0,@all_map,Rect.new(map_x,map_y,width,height))
# 刷新角色活动块
@character_sprites.sort!{|a,b|a.screen_z<=>b.screen_z}
for sprite in @character_sprites
if sprite.visible
sprite.update
px=sprite.screen_x-sprite.real_width/2
py=sprite.screen_y-sprite.real_height
self.blt(px,py,sprite,Rect.new(0,0,sprite.real_width,sprite.real_height),sprite.opacity)
for mask_id in sprite.maskTitles
next unless $game_map.valid?(mask_id[0], mask_id[1])
for i in [2, 1, 0]
tile = @map_data[mask_id[0], mask_id[1], i]
next if tile == 0 #透明的
if $game_map.priorities[tile] > mask_id[2]
if tile < 384
if tile >= 48
tile -= 48
src_rect = Rect.new(32, 2 * 32, 32, 32)
self.blt(mask_id[0] * 32 - map_x, mask_id[1] * 32 - map_y, @autotiles[tile / 48], src_rect)
end
else
tile -= 384
src_rect = Rect.new(tile % 8 * 32, tile / 8 * 32, 32, 32)
self.blt(mask_id[0] * 32 - map_x, mask_id[1] * 32 - map_y, @tileset, src_rect)
end
break
end
end
end
end
end
end
def dispose
super
# 释放元件地图
@tileset.dispose
for i in 0..6
@autotiles[i].dispose
end
# 释放角色活动块
for sprite in @character_sprites
sprite.dispose
end
@all_map.dispose
end
def make_map
for y in 0...$game_map.height
for x in 0...$game_map.width
for z in 0...3
tile = @map_data[x, y, z]
next if tile == nil
if tile < 384
if tile >= 48
tile -= 48
src_rect = Rect.new(32, 2 * 32, 32, 32)
@all_map.blt(x * 32, y * 32, @autotiles[tile / 48], src_rect)
end
else
tile -= 384
src_rect = Rect.new(tile % 8 * 32, tile / 8 * 32, 32, 32)
@all_map.blt(x * 32, y * 32, @tileset, src_rect)
end
end
end
end
end
def map_width
return @map_cw
end
def map_height
return @map_ch
end
def map_x
return $game_map.display_x / 4
end
def map_y
return $game_map.display_y / 4
end
end
复制代码
上面的是动态模糊脚本
#==============================================================================
# ■ Sprite_Character
#------------------------------------------------------------------------------
# 角色显示用脚本。监视 Game_Character 类的实例、
# 自动变化脚本状态。
#==============================================================================
$变大比率 = 1.0
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :character # 角色
#--------------------------------------------------------------------------
# ● 初始化对像
# viewport : 查看端口
# character : 角色 (Game_Character)
#--------------------------------------------------------------------------
def initialize(viewport, character = nil)
super(viewport)
@character = character
update
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
#--------------------------------------------------------------------------
self.zoom_x = self.zoom_y = $变大比率
#--------------------------------------------------------------------------
# 元件 ID、文件名、色相与现在的情况存在差异的情况下
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
# 记忆元件 ID 与文件名、色相
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
# 元件 ID 为有效值的情况下
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
# 元件 ID 为无效值的情况下
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
# 设置可视状态
self.visible = (not @character.transparent)
# 图形是角色的情况下
if @tile_id == 0
# 设置传送目标的矩形
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
# 设置脚本的坐标
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(@ch)
# 设置不透明度、合成方式、茂密
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
# 动画
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
end
end
复制代码
上面的是人物放大脚本
如果这两个脚本同时使用就会产生BUG,人物是变大的,但是模糊的残影还是原来的大小,请问如何让这两个脚本兼容? dsu_plus_rewardpost_czw
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1