查看: 9145|回复: 11

[原创发布] 自制简易 标题 粒子/花瓣/雪花 系统

[复制链接]
梦石
0
星屑
487
在线时间
908 小时
注册时间
2009-10-12
回帖
1702
发表于 2016-3-27 02:37:01 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

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

×
本帖最后由 日月星辰 于 2016-3-27 02:38 编辑

test.png

效果如图,粒子可以为花瓣,雪花等,只要能找到相应素材即可。可以设置粒子数量、移动速度/方向,还可设置自转(具体见 插件help)

[fold=代码][pre lang="javascript" line="1" file="TitleParticles"]
/*:
* @author 日月星辰
* @plugindesc 标题粒子效果
* @help
* 在标题画面中显示粒子
*
* @param file
* @desc 存于img/pictures的粒子图片名,默认particle。请确保图片存在且为.png格式
* @default particle
*
* @param num
* @desc 粒子的数量/密度,默认20
* @default 20
*
* @param xSpeed
* @desc 粒子x轴移动速度,可+可﹣,0为不动。默认1。
* @default 1
*
* @param ySpeed
* @desc 粒子y轴移动速度,可+可﹣,0为不动。默认1。
* @default 1
*
* @param rotation
* @desc 粒子自转的速度。如花瓣绕花心转。推荐范围[0, 0.01]。默认0.01。
* @default 0.01
*/

(function() {
    var params = PluginManager.parameters('SnapBlur');
    var file = String(params['file'] || 'particle');
    var num = Number(params['num'] || 20);
    var xS =  Number(params['xSpeed'] || 1);
    var yS =  Number(params['ySpeed'] || 1);
    var rotation = Number(params['rotation'] || 0.01);

    function Sprite_Particle() {
        this.initialize.apply(this, arguments);
    }

    Sprite_Particle.prototype = Object.create(Sprite_Base.prototype);
    Sprite_Particle.prototype.constructor = Sprite_Particle;

    Sprite_Particle.prototype.initialize = function(Particle) {
        Sprite_Base.prototype.initialize.call(this);
        this._phase = false;
        this.updateBitmap();
        this.updatePosition();
    }

    Sprite_Particle.prototype.updateBitmap = function() {
        this.bitmap = ImageManager.loadPicture(file);
    }

    Sprite_Particle.prototype.updatePosition = function() {
        this.anchor.x = Math.random(360);
        this.anchor.y = Math.random(360);
        this.x = Math.randomInt(Graphics.boxWidth);
        this.y = Math.randomInt(Graphics.boxHeight);
    }

    Sprite_Particle.prototype.update = function() {
        this.x += xS;
        this.y += yS;
        this.rotation += rotation;

        if (!this._phase) {
            if (this.opacity <= 0) {
                this._phase = true;
                this.updatePosition();
            } else {
                this.opacity -= 1;
            }
        } else {
            this.reverseOpacity();
        }
    }

    Sprite_Particle.prototype.reverseOpacity = function() {
        if (this.opacity < 255) this.opacity += 10;
        else this._phase = false;
    }

    var sceneTitle_create = Scene_Title.prototype.create;
    Scene_Title.prototype.create = function() {
        sceneTitle_create.call(this);
        this.createParticle();
    }

    Scene_Title.prototype.createParticle = function() {
        this._particles = [];
        for (var i = 0; i < num; i++) {
            var Particle = new Sprite_Particle();
            this._particles.push(Particle);
            this.addChild(this._particles);
        }
    }
})();
[/pre][/fold]

顺便,效果图里的素材:
particle.png

评分

参与人数 5星屑 +132 赞 +3 收起 理由
陆鲸社 + 1
knifa404 + 1 精品文章
yueshiguili112 + 1 精品文章
zjynew2 + 66 塞糖
刺夜之枪 + 66 为什么没人评分

查看全部评分

梦石
0
星屑
50
在线时间
114 小时
注册时间
2012-5-26
回帖
79
发表于 2016-4-19 09:35:33 | 显示全部楼层
请问我想在游戏标题界面最下方滚动显示文字“道具、金币掉落率双倍(仅限苹果IOS玩家)”,该如何做到。你能在插件中增加一项这个功能的代码吗?

点评

好样的,二楼  发表于 2016-4-19 12:11
回复

使用道具 举报

梦石
0
星屑
50
在线时间
51 小时
注册时间
2011-7-1
回帖
41
发表于 2017-4-25 09:30:26 | 显示全部楼层
感谢LZ,但是可以帮忙转一下XP吗?我不会...XP用不了
回复 1 0

使用道具 举报

梦石
0
星屑
105
在线时间
121 小时
注册时间
2016-8-25
回帖
26
发表于 2017-5-16 20:42:53 | 显示全部楼层
求问为什么改了数据之后没有任何变化?
回复

使用道具 举报

梦石
0
星屑
153
在线时间
26 小时
注册时间
2018-8-20
回帖
20
发表于 2018-8-21 05:18:18 | 显示全部楼层
非常感谢!
回复

使用道具 举报

梦石
0
星屑
2572
在线时间
212 小时
注册时间
2018-8-8
回帖
80
发表于 2018-9-29 13:33:19 | 显示全部楼层
脚本盲弱弱地问一句……该插在哪里,求具体教程QAQ
回复

使用道具 举报

梦石
0
星屑
287
在线时间
33 小时
注册时间
2018-9-30
回帖
23
发表于 2018-10-2 10:38:25 | 显示全部楼层
简单实用,赞一个!
每个问题的答案,都在你灵魂深处
回复

使用道具 举报

梦石
0
星屑
69
在线时间
0 小时
注册时间
2018-11-30
回帖
32
发表于 2018-11-30 04:22:22 | 显示全部楼层
感谢楼主分享 好贴果断收藏
回复

使用道具 举报

梦石
0
星屑
17
在线时间
2 小时
注册时间
2018-11-30
回帖
4
发表于 2018-11-30 08:20:31 | 显示全部楼层
感谢楼主 赞
回复

使用道具 举报

梦石
0
星屑
220
在线时间
20 小时
注册时间
2018-7-2
回帖
4
发表于 2018-12-12 23:30:40 | 显示全部楼层
非常感谢!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部