设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 94|回复: 0

[转载发布] Altimit Character Animations [0.01α]

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    7959

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    29925
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    38778

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    Altimit Character Animations 0.01 alpha

    This is an open-source project, feel free to clone the repository and make pull requests.

    About

    This Plugin adds the ability to greatly extend the animation system for character sprites.

    Altimit Character Animations offers flexibility that no-other character animation Plugin can through the use of Javascript as a scripting method for selecting your animation states.

    This allows custom states to be created and custom conditions to be written to massively expand how character animations can be done.

    The goal is for Altimit Character Animations to be the ultimate extra-frames Plugin.

    Download Latest Version
    Features

    • 8 direction support
    • Unlimited animation frames
    • Any sized, any layout sprite-sheets
    • Compatibility with Altimit Movement, including XML defined colliders
    • Javascript scripting interface
    Alpha Release

    The alpha release is the early days of the Plugin whilst the API is assessed and features added.

    The goal is to bring it up to par with other existing extra-frames Plugins and provide everything needed for developers to create a game using all the features available with the Plugin.

    Known Issues

    The latest issues are listed on the project page at the following URL: github.com/AltimitSystems/mv-plugins/issues

    Feel free to report issues in this thread or create a new issue on the project tracker (label as Altimit Character Animations).

    API

    $params includes the following properties:

    • direction - character facing direction
    • direction4 - direction limited to up, down, left, right
    • direction8 - for use with 8 direction movement, some Plugins will let you use normal "direction"
    • travelled - How many pixels has the character moved since the last frame


    • state - contains character's current state and how many frames they've been in the state
    • lastState - contains character's previous state (if there is one)
    • override - Boolean set to true if the state has been overridden with a custom state


    • tilesetId - sprite tileset ID
    • tileId - sprite tile ID
    • characterName - This should be the same as the XML file name
    • characterIndex - Sprite index on multi-sprite character sheets
    • character - Game_Character, comes with all properties that Game_Character has. Very powerful!


    • isDebugThrough - Boolean set to true when debug walk-through-walls is active
    • isDashButtonPressed - Different to $params.state.dashing
    • isOnDamageFloor - Character on floor damage tile (applies only to Player by default)
    The in-built states are:

    • state.bush - Character is in a bush
    • state.dashing - Character is dashing (running)
    • state.jumping - Character is jumping
    • state.ladder - Character is on ladder
    • state.moving - Character is moving
    • state.idle - Character is doing nothing
    Custom states should not use these names. So if you want a state for when your character is handsome, don't call it "dashing", call it "handsome" and then you can reference it with $params.state.handsome

    The animation return structure has the following options:

    • animation - ID of the XML animation to play-back
    • oneShot - Boolean, if set to true then the animation will play once and stop on the last frame (default false)
    • scaleX - Scales sprite in X axis (default 1)
    • scaleY - Scales sprite in Y axis(default 1)
    • speed - Play-back speed multiplier (default 1)
    Both the XML animation-list and animation tags support scaling properties "sx" and "sy":
                    Code:       
    1. <!-- All sprite frames will be 2x bigger -->
    2. <animation-list sheet="my_sheet" sx="2" sy="2">
    3.     <!-- When this animation is playing, sprite will be 50% sized -->
    4.     <!-- Combined with the animation-list scale, this results in a 1x (normal!) sized sprite -->
    5.     <animation id="my_animation" sx="0.5" sy="0.5">
    6.         <!-- Frames go here -->
    7.     </animation>
    8. </animation-list>
    复制代码

    These scaling properties can be used to mirror sprites; simply scale with a negative value. This is useful if you want to re-use sprite frames for both the left and right directions.

    Usage

    To add a character animation extension to a sprite sheet simply create an XML file in the img/characters folder with the same file name as the character sheet you wish to extend.

    For example, to extend Actor1.png we'd create Actor1.xml next to it.

    There are two required structures in the XML file:

    • animation-list
    • script
    The animation list must contain a property defining which image to use as a source of the extra frames.

    So to extend Actor1.png with Actor1_extra.png our XML file should look similar to this:
                    HTML:       
    1. <!-- Notice Actor1_extra, this says "Use Actor1_extra.png for these frames" -->
    2. <animation-list sheet="Actor1_extra">
    3. </animation-list>
    4. <!-- The script is where we write our animation state logic -->
    5. <script>
    6. </script>
    复制代码


    Let's say we want to add an "idle" animation for when the first Actor1 character is waiting around for more than 10 seconds (600 frames).

    We first need to write out where in the Actor1_extra these "idle" animation frames are.
                    HTML:       
    1. <animation-list sheet="Actor1_extra">
    2.     <!-- Our idle animation for when the character is facing "down" -->
    3.     <!-- The "rate" is the frames-per-second of the animation -->
    4.     <animation id="idle_south" rate="10">
    5.         <!-- The animation frames -->
    6.         <!-- These are texture co-ordinates on the sprite sheet -->
    7.         <!-- In this example, one frame is 64x64 pixels and there are 5 frames, left-to-right -->
    8.         <frame x="0" y="0" width="64" height="64" />
    9.         <frame x="64" y="0" width="64" height="64" />
    10.         <frame x="128" y="0" width="64" height="64" />
    11.         <frame x="196" y="0" width="64" height="64" />
    12.         <frame x="256" y="0" width="64" height="64" />
    13.     </animation>
    14. </animation-list>
    15. <script>
    16. </script>
    复制代码

    Now that we've written out where the animation frames for our down-facing idle animation is we need to write script logic for selecting the frames.

                    HTML:       
    1. <animation-list sheet="Actor1_extra">
    2.     <animation id="idle_south" rate="10">
    3.         <frame x="0" y="0" width="64" height="64" />
    4.         <frame x="64" y="0" width="64" height="64" />
    5.         <frame x="128" y="0" width="64" height="64" />
    6.         <frame x="196" y="0" width="64" height="64" />
    7.         <frame x="256" y="0" width="64" height="64" />
    8.     </animation>
    9. </animation-list>
    10. <!-- Scripting is in Javascript -->
    11. <script>
    12.     // The $params variable holds information about the current state
    13.     // The script must return a structure defining the animation
    14.   
    15.     // If we are facing south and have been idle for over 10 seconds (600 frames)
    16.     if ( $params.direction == 2 && $params.state.idle > 600 ) {
    17.         // Play the idle_south animation, defined in XML
    18.         // oneShot will play the animation once and stay on the final frame
    19.         return { animation: "idle_south", oneShot: true };
    20.     }
    21. </script>
    复制代码

    For an idea of how advanced this can be, animations for "enter idle" can be defined and the $params.state.idle frames can be used to detect the start of idling, then after N frames it can play an "idle loop" animation.

    Character states can be override with custom states also. If I wanted to set a "fishing" state to $gamePlayer I can call $gamePlayer.extraStateSet( ["fishing"] ). If I want to stop overriding states (such as fishing has been completed) I can use $gamePlayer.extraStateReset().


    本贴来自国际rpgmaker官方论坛作者:xilefian处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/altimit-character-animations-0-01a.89437/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-1 02:37 , Processed in 0.101613 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表