Quick Animations - Repaired
#1
Quick Animations - Repaired
Version: 1.0
Based on the work of SephirothSpawn



Introduction
The original Quick Animations by SephirothSpawn answered a call placed by people wondering if it would be possible to show cell animations of a sort in RPGMaker XP, similar to the animations performed by an Animated Gif. His method made use of assigning a folder that had a series of .png files numbered from 1.png on up, and playing them in sequence. The drawback, however, was that the folder was not specified as one of the Cache files in the Graphics folder, and was not saved/stored or accessible withing the encrypted .rgssad folder.

This rewrite of his system lets you create folders within the Graphics\Pictures folder which will be encrytped and playable from your final product.



Script
Yes... the script. And not even a download, but right here. It was just too easy an edit.
Code:
#==============================================================================
# ** Quick Animations - Repaired
#    Based on SephirothSpawn's work (2006-07-06)
#==============================================================================
#  Version 1.0
#  by DerVVulfman
#  01-24-2012
#------------------------------------------------------------------------------
# * Instructions
#
#  ~ Creating Animation
#
#    <object_name> = Quick_Animation.new(directory, loop, frame_skip, viewport)
#
#    directory  : Directory in your Graphics\Pictures Folder for the image set.
#    loop       : true (image loops) or false (image plays and disposes itself)
#    frame_skip : number of frames to proceed to next image
#    viewport   : viewport of image
#
#  ~ Object must execute, or frames won't pass through.
#  ~ Don't update a object after it disposes. A quick way around of this
#
#------------------------------------------------------------------------------
#
#  SAMPLE CODE:
#
#  -- assuming there is a directory called GIFS in your Pictures folder
#  -- assuming the .png files within are 1.pic, 2.pic, 3.pic... etc
#
#       class Scene_Title
#         alias seph_demo_scnttl_main main
#         alias seph_demo_scnttl_update update
#         def main
#           @image1 = Quick_Animation.new('GIFS/', true, 5)
#           @image1.x = 224
#           @image1.y = 238
#           @image1.z = 9999
#           seph_demo_scnttl_main
#           @image1.dispose
#         end
#         def update
#           seph_demo_scnttl_update
#           @image1.execute
#         end
#       end
#
#  -- A base mirror of SephirothSpawn's original demo code, though I only
#  -- desired to show one of the image sets instead of the three.  Very
#  -- little was done to the commands and users of the original should
#  -- have almost no issue learning how to use the new variant.
#
#------------------------------------------------------------------------------
#
#  NOTES REGARDING THE ORIGINAL:
#
#  Changes were added so the graphics can be cached and stored within an
#  encrypted archive.  The previous version did not account for this.
#
#  The previous system included an 'update' method to be called.  This was
#  abandoned and replaced with an 'execute' command to avoid an occurring
#  stack error.  
#
#==============================================================================


#==============================================================================
# ** RPG::Cache
#------------------------------------------------------------------------------
#  This is a module that loads each of RPGXP's graphic formats, creates a
#  Bitmap object, and retains it.
#==============================================================================

module RPG::Cache
  #--------------------------------------------------------------------------
  # * Test Cache File #1 (no hue option)
  #     type     : cache type (autotile, icon, picture, etc.)
  #     filename : filename of the cached bitmap
  #--------------------------------------------------------------------------  
  def self.test_1(type, filename)
    failed = false
    begin
      bitmap = eval("self.#{type}(filename)")
    rescue Errno::ENOENT      
      failed = true
    end
    return !failed
  end
end
  
#==============================================================================
# ** Quick_Animation
#==============================================================================

class Quick_Animation < Sprite
  #--------------------------------------------------------------------------
  # * Object Initialization
  #  ~ directory : foldername in Pictures Folder
  #  ~ loop : true or false to loop or not loop image
  #  ~ frame_skip : number of frames to advance next image
  #  ~ viewport : viewport on window
  #--------------------------------------------------------------------------
  def initialize(directory, loop = true, frame_skip = 10, viewport = nil)
    super(viewport)
    # Stores Directory, Loop & Frame Skip Count
    @directory, @loop, @frame_skip = directory, loop, frame_skip
    # Starts Index Count
    @index = 0
    # Updates Bitmap
    execute
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def execute
    # Stop Unless Frame Skip Reached
    return unless Graphics.frame_count % @frame_skip == 0
    @index = 0 if @index.nil?
    # Adds 1 to the index
    @index += 1
    # If not Last Image
    filename = @directory + @index.to_s
    if RPG::Cache.test_1('picture', filename)
      # Sets Bitmap
      self.bitmap = RPG::Cache.picture(@directory+ @index.to_s)
    # If Last Image Already Displayed
    else
      # If Loop Image
      if @loop
        # Reset Index & Update Bitmap
        @index = 0
        update
      # If No Loop
      else
        # Delete Image
        self.dispose
      end
    end
  end
end



Instructions
Pretty much in the script. It may take a little time to get the hang of it.



Compatibility
Designed mainly for use with RPGMaker XP. however I don't see much editing necessary for use with RPGMaker VX. Not sure about VXAce though.



Terms and Conditions
Free for use. Just give proper credits. Not just for I, but SephirothSpawn who made the bulk of the script.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }


Messages In This Thread
Quick Animations - Repaired - by DerVVulfman - 01-25-2013, 06:15 AM
RE: Quick Animations - Repaired - by yamina-chan - 01-25-2013, 12:28 PM
RE: Quick Animations - Repaired - by DerVVulfman - 01-26-2013, 04:45 AM
RE: Quick Animations - Repaired - by yamina-chan - 01-28-2013, 12:46 PM
RE: Quick Animations - Repaired - by Taylor - 01-29-2013, 10:06 PM
RE: Quick Animations - Repaired - by DerVVulfman - 01-30-2013, 04:19 AM
RE: Quick Animations - Repaired - by DerVVulfman - 01-31-2013, 12:46 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
   ATOA Chanting Battle Animations DerVVulfman 9 17,879 01-12-2017, 01:46 PM
Last Post: Noctis
   Animations Trickster 4 9,739 01-15-2012, 05:32 AM
Last Post: Lupinos
   Quick Keys blazingamer 0 4,725 03-07-2008, 06:56 AM
Last Post: blazingamer
   AUDIO FIX - Battle Animations DerVVulfman 0 5,384 03-05-2008, 06:44 AM
Last Post: DerVVulfman



Users browsing this thread: 2 Guest(s)