Jump to content

Recommended Posts

Individual Animation Rate

 

Introduction :

For anyone who want to set up individual animation rate for each animation in database, this script might help you. What is the mean of animation rate anyway? It's a speed rate how animation is being played. By default, one frame animation is same as 4 frame. By adding this script, you can speed up animation speed rate.

 

Script :

 

 

#===============================================================================
# Simple Individual Animation Rate
# By : TheoAllen
#-------------------------------------------------------------------------------
#
# Usage :
# Put this script below material but above main. Also if you use YEA - Core
# Engine put this script below YEA.
#
# To setup an animation rate for each animation in database, add following
# tag to animation name
#
# <rate: n>
# 
# Replace n with any number. The lowest value, the faster animation will be
# played. By default, animation rate is 4.
#
# Example for animation name in database:
# Fireball<rate:2>
#
# This just a simple script snippet. You're free to edit or repost it anywhere.
# However, if you a good person, please do not claim
#
#-------------------------------------------------------------------------------
# End of instruction
#===============================================================================

class RPG::Animation
  Default_Rate = 3 # <-- Change default anim rate for all animations here
  
  def anim_rate
    return @anim_rate if @anim_rate
    @anim_rate = Default_Rate
    if name[/<rate:\s*(\d+)>/]
      @anim_rate = $1.to_i
    end
    return @anim_rate
  end
  
end

class Sprite_Base
  
  # Overwrite animation rate
  def set_animation_rate
    @ani_rate = @animation.anim_rate
  end
  
end 

 

 

 

Sample usage :

 

OroW8j0.png

 

 

This just a simple snippet. Feel free to edit, repost, or even use in commercial game.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted