RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VX] Blurring Character Sprite On-The-Fly Question

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
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.

Code: [Select]
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
« Last Edit: June 26, 2011, 03:59:56 AM by Exhydra »

UPDATED 05-29-14


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

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

***
Rep:
Level 81
Monster Hunter
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
Code: [Select]
#==================================================================#
#  #*****************#         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 :(
« Last Edit: June 30, 2011, 06:04:45 PM by Mitsarugi »

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
Hehe, not a problem.

UPDATED 05-29-14


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

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

***
Rep:
Level 81
Monster Hunter
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?
« Last Edit: June 30, 2011, 07:19:17 PM by Mitsarugi »

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
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