Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[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

Code:
#==============================================================================

# ** Animation Player

#------------------------------------------------------------------------------

#  © Dargor, 2009

#  04/11/09

#  Version 1.0

#------------------------------------------------------------------------------

#  VERSION HISTORY:

#   - 1.0 (04/11/09), Initial release

#------------------------------------------------------------------------------

#  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. 

#==============================================================================

 

#==============================================================================

# ** Scene_Base

#------------------------------------------------------------------------------

#  This is a superclass of all scenes in the game.

#==============================================================================

 

class Scene_Base

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_anim_player_scene_base_start start

  alias dargor_vx_anim_player_scene_base_update update

  alias dargor_vx_anim_player_scene_base_terminate terminate

  #--------------------------------------------------------------------------

  # * Start Processing

  #--------------------------------------------------------------------------

  def start

    dargor_vx_anim_player_scene_base_start

    @animation_sprite = Sprite_Base.new

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    dargor_vx_anim_player_scene_base_update

    @animation_sprite.update unless @animation_sprite.nil?

  end

  #--------------------------------------------------------------------------

  # * Terminate Processing

  #--------------------------------------------------------------------------

  def terminate

    dargor_vx_anim_player_scene_base_terminate

    @animation_sprite.dispose unless @animation_sprite.nil?

  end

  #--------------------------------------------------------------------------

  # * Play Animation

  #--------------------------------------------------------------------------

  def play_animation(x,y,id,hit=true)

    @animation_sprite.x = x

    @animation_sprite.y = y

    @animation_sprite.start_animation($data_animations[id], hit)

    @animation_sprite.update

  end

end

 

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.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top