查看: 9352|回复: 11

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

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

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

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

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

test.png

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

代码

  1. /*:
  2. * @author 日月星辰
  3. * @plugindesc 标题粒子效果
  4. * @help
  5. * 在标题画面中显示粒子
  6. *
  7. * @param file
  8. * @desc 存于img/pictures的粒子图片名,默认particle。请确保图片存在且为.png格式
  9. * @default particle
  10. *
  11. * @param num
  12. * @desc 粒子的数量/密度,默认20
  13. * @default 20
  14. *
  15. * @param xSpeed
  16. * @desc 粒子x轴移动速度,可+可﹣,0为不动。默认1。
  17. * @default 1
  18. *
  19. * @param ySpeed
  20. * @desc 粒子y轴移动速度,可+可﹣,0为不动。默认1。
  21. * @default 1
  22. *
  23. * @param rotation
  24. * @desc 粒子自转的速度。如花瓣绕花心转。推荐范围[0, 0.01]。默认0.01。
  25. * @default 0.01
  26. */

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

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

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

  39.     Sprite_Particle.prototype.initialize = function(Particle) {
  40.         Sprite_Base.prototype.initialize.call(this);
  41.         this._phase = false;
  42.         this.updateBitmap();
  43.         this.updatePosition();
  44.     }

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

  48.     Sprite_Particle.prototype.updatePosition = function() {
  49.         this.anchor.x = Math.random(360);
  50.         this.anchor.y = Math.random(360);
  51.         this.x = Math.randomInt(Graphics.boxWidth);
  52.         this.y = Math.randomInt(Graphics.boxHeight);
  53.     }

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

  58.         if (!this._phase) {
  59.             if (this.opacity <= 0) {
  60.                 this._phase = true;
  61.                 this.updatePosition();
  62.             } else {
  63.                 this.opacity -= 1;
  64.             }
  65.         } else {
  66.             this.reverseOpacity();
  67.         }
  68.     }

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

  73.     var sceneTitle_create = Scene_Title.prototype.create;
  74.     Scene_Title.prototype.create = function() {
  75.         sceneTitle_create.call(this);
  76.         this.createParticle();
  77.     }

  78.     Scene_Title.prototype.createParticle = function() {
  79.         this._particles = [];
  80.         for (var i = 0; i < num; i++) {
  81.             var Particle = new Sprite_Particle();
  82.             this._particles.push(Particle);
  83.             this.addChild(this._particles[i]);
  84.         }
  85.     }
  86. })();
复制代码


顺便,效果图里的素材:
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.

在本版发帖返回顶部