RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[VX] Blurring Character Sprite On-The-Fly Question

Started by exhydra, June 26, 2011, 02:07:02 AM

0 Members and 1 Guest are viewing this topic.

exhydra

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

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

Mitsarugi

#1
make an event when going up the stairs increasing the player's size then transfer him up stairs , then upstairs make an event to reduce his size and transfering him down
i use this one
#==================================================================#
#  #*****************#         Zoom char V 0.5 , Falcao script     #
#  #*** By Falcao ***#         allow you to increse the chara size #                   
#  #*****************#         making zoom effect.                 #
#         RMVX                                                     #
# makerpalace.onlinegoo.com                                        #
#==================================================================#

#-------------------------------------------------------------------
# * Commands
#
# $game_player.zoom(x,y)      player zoom command,
# Example.  $game_player.zoom(2,2) increase double
#
# $game_map.events[Event ID].zoom(x,y)   event zoom command
# Example  $game_map.events[1].zoom(2,2)  event ID 1 increase double
#
# Note: Zoom support decimals
# Default zoom for each character is "(1,1)"
#--------------------------------------------------------------------

class Game_Character
  attr_accessor :zoom_x
  attr_accessor :zoom_y
  alias falcaozoom_ini initialize
  def initialize
    falcaozoom_ini
    @zoom_x = 1.0
    @zoom_y = 1.0
  end
  def zoom(x,y)
    self.zoom_x = x
    self.zoom_y = y
  end
end

class Sprite_Character < Sprite_Base
alias character_zoom_update update
def update
     character_zoom_update
     if @zoom_x != @character.zoom_x or
        @zoom_y != @character.zoom_y
        @zoom_x = @character.zoom_x
        @zoom_y = @character.zoom_y       
        self.zoom_x = @character.zoom_x
        self.zoom_y = @character.zoom_y
     end   
end
end

class Game_Player < Game_Character
  def zoom(x,y)
    self.zoom_x = x
    self.zoom_y = y
  end
end



EDIT : Damn i misunderstood what you wanted sorry :(

exhydra


UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

Mitsarugi

#3
found a script that blurs everything  but dont think its what you want ^^

EDIT: you could just make a blured character with GIMP , PAINT, PHOTOSHOP etc... and replace the sprite no?

exhydra

That's correct. Although, as I'm trying to incorporate MA's Composite Characters / Visual Equipment script, I'll need something that can blur the sprite just before it gets painted onto the screen.

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5