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

[转载发布] Set Flashing Animation | Mouse Press Plugin

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

    连续签到: 2 天

    [LV.7]常住居民III

    8307

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 6 天前 | 显示全部楼层 |阅读模式
    Howdy all - for RPG Maker MV v1.5





    Why
    I picked up MV months ago, but decided to play with it today.  I love it, but I didn't like the default square blinking effect on press.  So, I thought I'd do the responsible thing and create a plugin to grant more options.

    What
    This lets you completely disable, and/or customize the blink effect when clicking or pressing.

    Options

    While messing around I chucked a bunch of options in there.

    Color
    Any CSS color including RGB and RGBA

    Types
    none, circle, square, box, url, text, circleoutline

    Scale
    0 to 1

    Data
    (optional) String or image URL to use

    Animate
    on or off, for the blink effect

    BounceSpeed
    Works inversely, I like 40, 60 or 90.​

    Script:

    License is do whatever you want (tm).  Yes, you can use it commercially.

    filename: SetFlashAnimation.js,
    save in your projects js\plugins folder.

                    Code:       
    1. /*:
    2. * @plugindesc Sets, changes or removes the flashing press indicator.  v1.0
    3. * @author Lloyd (Red Iron Labs)
    4. *
    5. * @help This plugin does not provide plugin commands.
    6. *
    7. * @param color
    8. * @desc CSS color format of the bitmap.  RGB & RGBA allowed (i.e. rgba(0, 255, 0, 0.3)).
    9. * @default white
    10. *
    11. * @param settype
    12. * @desc none, circle, square, box, url, text, circleoutline
    13. * @default none
    14. *
    15. * @param scale
    16. * @desc scale from 0 to 1
    17. * @default 1
    18. *
    19. * @param data
    20. * @desc the text string (i.e. X) OR reference URL to an image to use (i.e. img/system/Shadow1.png)
    21. * @default img/system/Shadow1.png
    22. *
    23. * @param animate
    24. * @desc Bouncing animation
    25. * @default on
    26. *
    27. * @param bouncespeed
    28. * @desc Speed of bounce
    29. * @default 20
    30. *
    31. */
    32. (function () {
    33.     function toNumber(str, def) {
    34.         return isNaN(str) ? def :  + (str || def);
    35.     }
    36.     var parameters = PluginManager.parameters('SetFlashAnimation');
    37.     var color = parameters['color'].toLowerCase();
    38.     var settype = parameters['settype'].toLowerCase();
    39.     var scale = toNumber(parameters['scale'], 1);
    40.     var data = parameters['data'];
    41.     var animate = parameters['animate'].toLowerCase() == "on";
    42.     var bouncespeed = toNumber(parameters['bouncespeed'], 20);
    43.     Sprite_Destination.prototype.updateAnimation = function () {
    44.         if (animate) {
    45.             this._frameCount++;
    46.             this._frameCount %= bouncespeed;
    47.             this.opacity = (bouncespeed - this._frameCount) * 6;
    48.             this.scale.x = 1 + this._frameCount / bouncespeed;
    49.             this.scale.y = this.scale.x;
    50.         }
    51.     };
    52.     Spriteset_Map.prototype.createDestination = function () {
    53.         if (settype != 'none') {
    54.             this._destinationSprite = new Sprite_Destination();
    55.             this._destinationSprite.z = 9;
    56.             this._tilemap.addChild(this._destinationSprite);
    57.         }
    58.     };
    59.     Sprite_Destination.prototype.createBitmap = function () {
    60.         var tileWidth = $gameMap.tileWidth();
    61.         var tileHeight = $gameMap.tileHeight();
    62.         this.bitmap = new Bitmap(tileWidth, tileHeight);
    63.         if (settype == 'square' || settype == 'box') {
    64.             this.bitmap.fillRect(
    65.                 (tileWidth - (tileWidth * scale)) / 2,
    66.                 (tileHeight - (tileHeight * scale)) / 2,
    67.                 tileWidth * scale,
    68.                 tileHeight * scale,
    69.                 color);
    70.             if (settype == 'box') {
    71.                 this.bitmap.clearRect(
    72.                     ((tileWidth - (tileWidth * scale)) / 2) + 4,
    73.                     ((tileHeight - (tileHeight * scale)) / 2) + 4,
    74.                     (tileWidth * scale) - 8,
    75.                     (tileHeight * scale) - 8);
    76.             }
    77.         }
    78.         if (settype == 'circle' || settype == 'circleoutline') {
    79.             var minSize = tileWidth;
    80.             if (tileHeight < tileWidth)
    81.                 minSize = tileHeight;
    82.             this.bitmap.drawCircle(tileWidth / 2, tileHeight / 2, (minSize / 2) * scale, color);
    83.             if (settype == 'circleoutline') {
    84.                 this.bitmap.drawCircle(tileWidth / 2, tileHeight / 2, ((minSize / 2) * scale) - 4, 'clear');
    85.             }
    86.         }
    87.         if (settype == 'text') {
    88.             this.bitmap.outlineColor = color;
    89.             this.bitmap.drawText(
    90.                 data,
    91.                 (tileWidth - (tileWidth * scale)) / 2,
    92.                 (tileHeight - (tileHeight * scale)) / 2,
    93.                 tileWidth * scale,
    94.                 tileHeight * scale,
    95.                 'center');
    96.             this.bitmap.blur();
    97.         }
    98.         if (settype == 'url') {
    99.             this.bitmap = ImageManager.requestNormalBitmap(data, 0); // Bitmap.load(data);
    100.             this.bitmap.resize(tileWidth, tileHeight);
    101.         };
    102.         this.anchor.x = 0.5;
    103.         this.anchor.y = 0.5;
    104.         this.blendMode = Graphics.BLEND_ADD;
    105.     };
    106. })();
    复制代码


    Images:













    Upcoming features:
    None planned - but it is a pretty basic script.  It isn't tested with other scripts, so could break stuff.  In which case, just use it to learn if you like.


    本贴来自国际rpgmaker官方论坛作者:Lloyd@RedIronLabs处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/set-flashing-animation-mouse-press-plugin.85334/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-1 20:48 , Processed in 0.096712 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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