With the help of this forum I got a script for both RMXP and RMVX to change the scale of a sprite. The code was written to make things smaller but I learned how to modify it to also make things bigger. I was wondering how to combine the 2 into one script or something so I can do either one at any time in the 'game' I am working on.
Here is the script as its is normally written.
I also know if you change the SMALLEST_SCALE to a number larger then 1.00 it makes the character larger. So as I said my question is how to have both a shrinking and giant code at the same time so I can either make a giant or a shrunk character in the same script.
Here is the script as its is normally written.
Code:
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass for the
# Game_Player and Game_Event classes.
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias_method :algn_shrinking_game_character_initialize, :initialize
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :shrinking
attr_reader :growing
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
algn_shrinking_game_character_initialize
@shrinking = nil
end
#--------------------------------------------------------------------------
# * Shrinky Dink Mode On
#--------------------------------------------------------------------------
def shrink
@shrinking = true
end
#--------------------------------------------------------------------------
# * Get Bigger Quicker
#--------------------------------------------------------------------------
def unshrink
@shrinking = nil
end
end
#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
# This sprite is used to display the character. It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias_method :algn_shrinking_sprite_character_update, :update
#--------------------------------------------------------------------------
# * Constant Variables
#--------------------------------------------------------------------------
SHRINK_RATE = 0.02 # Translates to a percentage of a 100%
SMALLEST_SIZE = 0.20 # The smallest percentage size the character can be.
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
algn_shrinking_sprite_character_update
# If the character is shrinking.
if @character.shrinking
# Test to see if we should continue to shrink.
if self.zoom_x > SMALLEST_SIZE
self.zoom_x -= SHRINK_RATE
self.zoom_y -= SHRINK_RATE
else
# Just in case the rate is uneven.
self.zoom_x = SMALLEST_SIZE
self.zoom_y = SMALLEST_SIZE
end
else
# If we are still smaller than 1.0
if self.zoom_x < 1.0
self.zoom_x += SHRINK_RATE
self.zoom_y += SHRINK_RATE
else
# Just in case the rate is uneven.
self.zoom_x = 1.0
self.zoom_y = 1.0
end
end
end
end
I also know if you change the SMALLEST_SCALE to a number larger then 1.00 it makes the character larger. So as I said my question is how to have both a shrinking and giant code at the same time so I can either make a giant or a shrunk character in the same script.