[Resolved] Invert Graphic in Game

Started by ShadowSaber, April 19, 2011, 06:48:25 am

Previous topic - Next topic

ShadowSaber

April 19, 2011, 06:48:25 am Last Edit: April 20, 2011, 01:32:49 am by ShadowSaber
Hello everyone,
I need help how to invert character graphic in map when game is playing

I found the script, but I don't know how to use it

---------edit : resolved-----------

brewmeister

This is a very simple implementation of just the invert method.

#=======================================================================
# ** Additional Bitmap Methods
#-----------------------------------------------------------------------
#   By Untra
#   5/5/10
#   v0.5
#=======================================================================
  #---------------------------------------------------------------------
  # * Invert
  #   WARNING: Inverting colors is especially process consuming, and
  #     with frequent use can lag a game indefinitely. Use sparringly. 
  #   NOTE: calling an invert color method a second time will bring its
  #     colors back to normal, assuming you didn't change its colors
  #     while in negative.
  #---------------------------------------------------------------------
  class Bitmap
  def invert
    for w in 0..(width - 1)
      for h in 0..(height - 1)
        color = get_pixel(w, h)
        r = 255 - color.red
        g = 255 - color.green
        b = 255 - color.blue
        a = color.alpha
        set_pixel(w, h, Color.new(r, g, b, a)) if a > 0
      end
    end
    return self
  end
end

#=======================================================================
# ** Additional Bitmap Methods Implemented
#=======================================================================

class Sprite_Character
  alias invert_update update
  def update
    invert_update
    if @character.inverting
      self.bitmap.invert
      @character.invert
    end
  end
end

class Game_Character
  attr_reader :inverting
  alias invert_init initialize
  def initialize
    invert_init
    @inverting = false
  end
  def invert
    @inverting = !@inverting
  end
end


To change the player, call

$game_player.invert

To change an event, call

event = get_character(0)
event.invert

ForeverZer0

April 19, 2011, 05:42:24 pm #2 Last Edit: April 19, 2011, 05:43:44 pm by ForeverZer0
DELETED POST

I totally just misread what this did...

I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

ShadowSaber

thanks brewmeister, now i understand how to use it ^^