In the last few days I've been futzing around with Bitmap and Sprite stuff, as I really haven't messed with it before. What I'm trying to do is blur just the active actor to simulate closeness to the 'camera' when combined with Falcoa's Zoom Character script. I made a quick mock-up to illustrate what I'm trying to achieve.
I've begun working on a script to do it, but I'd like to know if I'm on the right track. Is there an easier way of doing this than what I have? (sloppy alpha code included below; only works on the first actor in a typical 384x256 actor sheet)
Since blurring the entire bitmap causes portions to 'bleed' onto the next animation frame, I was thinking that I would have to copy each frame and blur it separately before combining them all and transferring them to the sheet to be used. I just thought that before I went to all that trouble, I'd see if there was a better way of going about this.
class Game_Character
attr_accessor :ex_char_display_blur
alias ex_char_display_init initialize unless $@
def initialize
ex_char_display_init
@ex_char_display_blur = 0
end
#--------------------------------------------------------------------------
# ยป cd_blur
# $game_player.cd_blur(blur_val)
#
# [blur_val]
# 0 - Blur character bitmap
# 1 - Replace original bitmap
#--------------------------------------------------------------------------
def cd_blur(blur_val)
self.ex_char_display_blur = blur_val
end
end
class Sprite_Character < Sprite_Base
alias ex_char_display_init initialize unless $@
def initialize(*args)
@clone_orig = nil
ex_char_display_init(*args)
end
alias ex_char_display_update update unless $@
def update
ex_char_display_update
case character.ex_char_display_blur
when 1 # Blur
clone_bitmap = self.bitmap.clone
@clone_orig = self.bitmap.clone
clone_bitmap.blur
blarg = Rect.new(0, 0, 96, 128)
self.bitmap.clear_rect(blarg)
self.bitmap.blt(0, 0, clone_bitmap, blarg)
character.ex_char_display_blur = 0
when 2 # Replace Original
blarg = Rect.new(0, 0, 96, 128)
self.bitmap.clear_rect(blarg)
self.bitmap.blt(0, 0, @clone_orig, blarg)
character.ex_char_display_blur = 0
end
end
end