[VX] Animation Player

Animation Player
Version: 1.0
By: Dargor


Introduction

A pretty simple script that let you play battle animations anywhere you want. And by anywhere I really mean anywhere; On the map, in the main menu, the title screen, etc.

Features
  • Can be used in any Scenes
  • Easy to use method to call the animation
  • No need of a dummy event on the map to play an animation.

Script

script Spoiler
  1. #==============================================================================
  2. # ** Animation Player
  3. #------------------------------------------------------------------------------
  4. #  © Dargor, 2009
  5. #  04/11/09
  6. #  Version 1.0
  7. #------------------------------------------------------------------------------
  8. #  VERSION HISTORY:
  9. #   - 1.0 (04/11/09), Initial release
  10. #------------------------------------------------------------------------------
  11. #  INSTRUCTIONS:
  12. #   - Paste this above main
  13. #   - In any scenes, use the following line of code to trigger an animation:
  14. #       play_animation(x,y,id,hit=true)
  15. #     X/Y is the X/Y position of the animation
  16. #     ID is the of the animation to be played
  17. #     HIT is a boolean to determine whether to play the "hit effects" of
  18. #       the animation or not.
  19. #==============================================================================
  20.  
  21. #==============================================================================
  22. # ** Scene_Base
  23. #------------------------------------------------------------------------------
  24. #  This is a superclass of all scenes in the game.
  25. #==============================================================================
  26.  
  27. class Scene_Base
  28.   #--------------------------------------------------------------------------
  29.   # * Alias Listing
  30.   #--------------------------------------------------------------------------
  31.   alias dargor_vx_anim_player_scene_base_start start
  32.   alias dargor_vx_anim_player_scene_base_update update
  33.   alias dargor_vx_anim_player_scene_base_terminate terminate
  34.   #--------------------------------------------------------------------------
  35.   # * Start Processing
  36.   #--------------------------------------------------------------------------
  37.   def start
  38.     dargor_vx_anim_player_scene_base_start
  39.     @animation_sprite = Sprite_Base.new
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # * Frame Update
  43.   #--------------------------------------------------------------------------
  44.   def update
  45.     dargor_vx_anim_player_scene_base_update
  46.     @animation_sprite.update unless @animation_sprite.nil?
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # * Terminate Processing
  50.   #--------------------------------------------------------------------------
  51.   def terminate
  52.     dargor_vx_anim_player_scene_base_terminate
  53.     @animation_sprite.dispose unless @animation_sprite.nil?
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # * Play Animation
  57.   #--------------------------------------------------------------------------
  58.   def play_animation(x,y,id,hit=true)
  59.     @animation_sprite.x = x
  60.     @animation_sprite.y = y
  61.     @animation_sprite.start_animation($data_animations[id], hit)
  62.     @animation_sprite.update
  63.   end
  64. end
  65.  
Expand to see the code.


Instructions

- Paste this above main
- In any scenes, use the following line of code to trigger an animation: play_animation(x,y,id,hit=true)
X/Y is the X/Y position of the animation
ID is the of the animation to be played
HIT is a boolean to determine whether to play the "hit effects" of the animation or not.

Compatibility

Should be compatible with everything.

Terms and Conditions

As usual, don't forget to give me credits!
Again if I was still into RM this would have been bloody useful :smoke:

Great script, and it works brilliantly. Especially useful for those who want "dynamic" title screens I guess.
It's great to have you back dargor. Your scripts are always brilliant.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=68893