Easy Actor Animations
By: FamilyGamer7
Introduction
The easiest way to implement a separate run/idle/overworld animation for the main hero actor.
Click to expand...
Features
The ability to have the actor animation change dependent upon what the actor is doing. Each type of animation will have its own specific .png it will pull from to perform the animations. The ability to change the actor animation movement speed has also been added for flexibility.
Click to expand...
Screenshots
- Not Needed -
Click to expand...
Demo
Provided as an "attachment" for reference purposes (The setup).
Click to expand...
Script
Spoiler: FG7 - Easy Actor Animations
Ruby: #============================================================================== # Title: Easy Actor Animations (Walk/Run/Idle/Overworld) # Author: FamilyGamer7 (FG7) # Version: 1.1 # Engine: RPG Maker VX Ace #============================================================================== # ** Change Log | # --------------- # 1.0 => Created Script # 1.1 => Ensures main actor walk sprite animation stays when swapped in formation #============================================================================== # ** Description | # ---------------- # The easiest way to implement a separate run/idle/overworld animation # for the main hero actor. #============================================================================== # ** Terms of Use | # ----------------- # * Free to use in non-commercial projects and commercial projects # * Feel free to modify and improve the script. Credit is still required. # * Credit FamilyGamer7 #============================================================================== # ** Usage | # ---------- # * NOT Plug & Play (See "Setup" and Module section for script fine tuning) #============================================================================== # ** Setup | # ---------- # # ---------------------------------- # | Actor Animation(s) Configuration | # --------------------------------------------------------------------------- # | The Actors name needs to be identical to the name used in the .png image. | # | (All images need to be placed in -> \Graphics\Characters | # --------------------------------------------------------------------------- # # Ex: If your hero actor name is Eric.... # # Normal: $Eric.png # Run: $Eric_run.png # Idle: $Eric_idle.png # Overworld: $Eric_overworld.png # #============================================================================== # ** Note(s) | # ----------- # * I used the "$" for the .png as this provides more freedom than conforming # to the generic VX Ace character sets. The goal was more flexibility. # # * The "idle" animation does not cycle through the animation constantly, it # only runs through once. So the idle animation would need to be something # like the actor sits down - that doesn't require constant updating. #============================================================================== # ** WARNING! | # ------------ # * DO NOT MARK "Disable Dashing" ON MAPS THAT ARE NOT OVERWORLD MAPS. IT WILL # RENDER THE SCRIPT PARTIALLY USELESS AS THE ANIMATION CHANGE WILL NOT WORK. # # * You are free to mark "Disable Dashing" on overworld maps and the script will # work as intended. #============================================================================== #============================================================================== # ** Module: FG7::Actor_Animations #------------------------------------------------------------------------------ # This modules creates a static variable to be used within the script. #============================================================================== module FG7 module Actor_Animations #============================================================================== # -------------------- ALLOWED TO EDIT BELOW THIS LINE ---------------------- # #============================================================================== # Sets the game variable value to reset the actor animation (when moving) # (Use any varaible that is not in use within your game) Game_Variable = 10 # Sets the count time for when the "idle" animation should trigger # (The higher the count, the longer the wait until idle is triggered) Count = 500 # Sets the main actor ID needed for the sprite animation change # (Actor ID that you are using within the game database - Ex: 001 = 1) Actor_ID = 1 # Sets the map name used for the "overworld" animation trigger # (This map display name can be anything - Only for overworld sprite) Game_Map_Name = "Overworld" # Sets the value for the actor sprite animation speed # (Decimal values are accepted as incremental - Ex: 0.5) Animation_Speed = 1 #============================================================================== # ---------- DO NOT EDIT BELOW THIS LINE (FOR ADVANCED USERS) --------------- # #============================================================================== end end #============================================================================== # ** Game_CharacterBase #------------------------------------------------------------------------------ # This base class handles characters. It retains basic information, such as # coordinates and graphics, shared by all characters. #============================================================================== class Game_CharacterBase #-------------------------------------------------------------------------- # * Override Method: Update Walking/Stepping Animation #-------------------------------------------------------------------------- def update_animation update_anime_count if @anime_count > 18 - real_move_speed * FG7::Actor_Animations::Animation_Speed update_anime_pattern @anime_count = 0 end end end #============================================================================== # ** Game_Player #------------------------------------------------------------------------------ # This class handles the player. It includes event starting determinants and # map scrolling functions. The instance of this class is referenced by # $game_player. #============================================================================== class Game_Player < Game_Character #-------------------------------------------------------------------------- # * Override Method: Get Corresponding Actor #-------------------------------------------------------------------------- def actor # Ensures the "Hero" is always the main walking sprite $game_actors[FG7::Actor_Animations::Actor_ID] end #-------------------------------------------------------------------------- # * Alias Method: Frame Update #-------------------------------------------------------------------------- alias :fg7_easy_actor_animations_update :update def update fg7_easy_actor_animations_update # Add count to $game_variable if on game map and not on game menu $game_variables[FG7::Actor_Animations::Game_Variable] += 1 if !$game_map.interpreter.running? end #-------------------------------------------------------------------------- # * Alias Method: Execute Player Transfer (For "Overworld" map) #-------------------------------------------------------------------------- alias :fg7_easy_actor_animations_perform_transfer :perform_transfer def perform_transfer fg7_easy_actor_animations_perform_transfer # Check if map is an "overworld" and change player sprite animation if $game_map.display_name.include?(FG7::Actor_Animations::Game_Map_Name) $game_actors[FG7::Actor_Animations::Actor_ID].set_graphic("$" + $game_actors[FG7::Actor_Animations::Actor_ID].name + "_overworld.png", 0, $game_actors[FG7::Actor_Animations::Actor_ID].face_name, $game_actors[FG7::Actor_Animations::Actor_ID].face_index) refresh else $game_actors[FG7::Actor_Animations::Actor_ID].set_graphic("$" + $game_actors[FG7::Actor_Animations::Actor_ID].name, 0, $game_actors[FG7::Actor_Animations::Actor_ID].face_name, $game_actors[FG7::Actor_Animations::Actor_ID].face_index) refresh end end #-------------------------------------------------------------------------- # * Override Method: Determine if Dashing (For - Walk / Run / Idle) #-------------------------------------------------------------------------- def dash? return false if @move_route_forcing return false if $game_map.disable_dash? return false if vehicle return Input.press?(:A) if $game_map.display_name.include?(FG7::Actor_Animations::Game_Map_Name) #return true if $game_map.display_name.include?(FG7::Actor_Animations::Game_Map_Name) # Change $game_variable back to "0" if player is moving $game_variables[FG7::Actor_Animations::Game_Variable] = 0 if moving? # Change player sprite animation to "run" if condition is met $game_actors[FG7::Actor_Animations::Actor_ID].set_graphic("$" + $game_actors[FG7::Actor_Animations::Actor_ID].name + "_run.png", 0, $game_actors[FG7::Actor_Animations::Actor_ID].face_name, $game_actors[FG7::Actor_Animations::Actor_ID].face_index) if Input.press?(:A) # Change player sprite animation to "normal" if condition is met $game_actors[FG7::Actor_Animations::Actor_ID].set_graphic("$" + $game_actors[FG7::Actor_Animations::Actor_ID].name, 0, $game_actors[FG7::Actor_Animations::Actor_ID].face_name, $game_actors[FG7::Actor_Animations::Actor_ID].face_index) if !Input.press?(:A) # Change player sprite animation to "idle" if condition is met $game_actors[FG7::Actor_Animations::Actor_ID].set_graphic("$" + $game_actors[FG7::Actor_Animations::Actor_ID].name + "_idle.png", 0, $game_actors[FG7::Actor_Animations::Actor_ID].face_name, $game_actors[FG7::Actor_Animations::Actor_ID].face_index) if !Input.press?(:A) && $game_variables[FG7::Actor_Animations::Game_Variable] > FG7::Actor_Animations::Count # Refresh player sprite animation refresh # Appended $game_variable and resetting back to "0" return Input.press?(:A) && $game_variables[FG7::Actor_Animations::Game_Variable] = 0 end end 复制代码
How to Use
Add this script in the script editor under in the "Materials" section and above "Main Process".
The instructions and setup for the script are held within the script header itself. No need to repeat here.
Click to expand...
Terms of Use
- Free to use in non-commercial projects and commercial projects
- Feel free to modify and improve the script. Credit is still required.
- Credit FamilyGamer7
Click to expand...
本贴来自国际rpgmaker官方论坛作者:FG7处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/fg7-easy-actor-animations.144540/