Main Menu
  • Welcome to The RPG Maker Resource Kit.

[XP] Animation Resizer

Started by game_guy, July 30, 2010, 04:55:56 AM

0 Members and 1 Guest are viewing this topic.

game_guy

Animation Resizer
Authors: game_guy
Version: 1.0
Type: Misc Add-on
Key Term: Misc Add-on


Introduction

Want to reduce or increase the size of certain animations? Don't wanna go  through all the tedious work to do it in the database? This script  can resize any animation for you.


Features


  • Increase animation size
  • Decrease animation size
  • Use only on specific animations
  • Use custom size value


Screenshots

N/A


Demo

N/A


Script

[SPOILER]
#===============================================================================
# Animation Resizer
# Author game_guy
# Version 1.0
#-------------------------------------------------------------------------------
# Intro:
# Want to reduce or increase the size of certain animations? Don't wanna go
# through all the tedious work to do it in the database? This script
# can resize any animation for you.
#
# Features:
# Increase animation size
# Decrease animation size
# Use only on specific animations
# Use custom size value
#
# Instructions:
# Note the animations also resize on events.
# Go down to config below.
# Default_Increase - This is the default amount that is used to resize an
#   animation that isn't configured.
# Configure Sizes - This is the config for setting up sizes for specific
#   animations only. If an animation isn't defined here then it uses
#   Default_Increase
#
# Don't want an animation resized on events? Simply use the following
# $game_system.anim_event = false
# Set it to true to have animations resized on events.
#
# Compatibility:
# Not tested with SDK.
# Should work where ever an animation is used.
#
# Credits:
# game_guy ~ For making it
# Jek ~ For requesting it
#===============================================================================
module GGHAN
 #==============================================
 # Config
 #==============================================
 # Default animation increase/decrease
 # Positive values = increase
 # Negative values = decrease
 Default_Increase = 0
 def self.zoom(id)
   case id
   #========================
   # Configure Sizes
   # Do:
   # when animation_id then return resize_amount_in_percent
   # Example:
   # when 67 then return 300
   # It increases the animation by 300 percent
   # Use negative values to decrease an animation.
   #
   # Note: When decreasing an animation size it can
   # only decrease it as much as possible before making
   # the animation dissappear.
   #========================
   when 67 then return 300
   when 1 then return -90
   end
   return 0
 end
 #==============================================
 # End Config
 #==============================================
end
class Game_System
 attr_accessor :anim_event
 attr_accessor :is_event
 alias gg_init_anim_resize_lat initialize
 def initialize
   @anim_event = true
   @is_event = false
   gg_init_anim_resize_lat
 end
end
module RPG
 class Sprite < ::Sprite
   def animation_set_sprites(sprites, cell_data, position)
     for i in 0..15
       sprite = sprites[i]
       pattern = cell_data[i, 0]
       if sprite == nil or pattern == nil or pattern == -1
         sprite.visible = false if sprite != nil
         next
       end
       sprite.visible = true
       sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
       if position == 3
         if self.viewport != nil
           sprite.x = self.viewport.rect.width / 2
           sprite.y = self.viewport.rect.height - 160
         else
           sprite.x = 320
           sprite.y = 240
         end
       else
         sprite.x = self.x - self.ox + self.src_rect.width / 2
         sprite.y = self.y - self.oy + self.src_rect.height / 2
         sprite.y -= self.src_rect.height / 4 if position == 0
         sprite.y += self.src_rect.height / 4 if position == 2
       end
       sprite.x += cell_data[i, 1]
       sprite.y += cell_data[i, 2]
       sprite.z = 2000
       sprite.ox = 96
       sprite.oy = 96
       if $scene.is_a?(Scene_Map) && $game_system.anim_event
         zoom = GGHAN.zoom(@_animation.id)
         if zoom < 0
           c = -zoom
           if cell_data[i, 3] <= c
             c = cell_data[i, 3] - 1
             cc = cell_data[i, 3] - c
             #p cc.to_s + " IF " + cell_data[i, 3].to_s
           else
             cc = cell_data[i, 3] - c
             #p cc.to_s + " ELSE " + cell_data[i, 3].to_s
           end
         else
           cc = cell_data[i, 3] + zoom
         end
         sprite.zoom_x = cc / 100.0
         sprite.zoom_y = cc / 100.0
       elsif $scene.is_a?(Scene_Map) && !$game_system.anim_event
         cc = cell_data[i, 3]
         sprite.zoom_x = cc / 100.0
         sprite.zoom_y = cc / 100.0
       elsif $scene.is_a?(Scene_Battle)
         zoom = GGHAN.zoom(@_animation.id)
         cc = cell_data[i, 3] + zoom
         sprite.zoom_x = cc / 100.0
         sprite.zoom_y = cc / 100.0
       end
       sprite.angle = cell_data[i, 4]
       sprite.mirror = (cell_data[i, 5] == 1)
       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
       sprite.blend_type = cell_data[i, 7]
     end
   end
 end
end

[/SPOILER]


Instructions

In the script.
Probably place below everything and above main.
Read all instructions carefully.


Compatibility

Not tested with SDK.


Credits and Thanks


  • game_guy ~ For making it
  • Jek ~ For requesting it


Author's Notes

Enjoy!