查看: 30682|回复: 34

[原创发布] 【插件】仿空轨地图人物气球

[复制链接]
梦石
0
星屑
3677
在线时间
4468 小时
注册时间
2008-6-12
回帖
776
发表于 2015-11-20 18:02:02 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 过眼云烟 于 2015-11-20 18:01 编辑

这是我尝试开发的第三个MV插件,希望大家多多回帖支持,你们的回帖会给我更大的动力!
效果的话类似于空之轨迹游戏中人物走近NPC会显示气泡表情,使用方法是在事件的说明中添加autoballoon_11,即显示11号表情。
截图中的素材为我按照空之轨迹修改后的实现的效果,附件中的图片取自MV RTP默认素材的表情文件,请参照此图格式制作您自己的表情合集。

后续版本将提供修改格式,显示速度等功能,敬请期待,当然如果大家留言不积极我就懒得继续开发了


Enjoy it~~~
如果有问题,欢迎留言。
效果如下:
地图自动气泡.png

使用方法:
使用方法.png

自动气球包素材格式,请放到System目录下:(参照)
Balloon_1.png


[pre lang="javascript" file="MrLiu_AutoBalloon.js"]//=============================================================================
// MrLiu_AutoBalloon.js
//=============================================================================

/*:
* @plugindesc 在RMMV游戏中地图界面的人物头顶自动显示气球
* @author MrLiu-过眼云烟
*
* @help 事件页的说明下加入“autoballoon_11”,即显示第11行的表情,需将Balloon_1.png
* 文件放在\img\system目录下,该文件默认大小为96*352,默认每格表情大小为32,每行3格
* 后续版本将提供修改格式,显示速度等功能,敬请期待,如有问题欢迎给我留言。
*/
//-----------------------------------------------------------------------------
var Imported = Imported || {};
Imported.MrLiu_AutoBalloon = true;

var Lmd = Lmd || {};
Lmd.MrLiu_AutoBalloon = Lmd.MrLiu_AutoBalloon || {};



  var parameters = PluginManager.parameters('MrLiu_Shadow');
  var displayAutoBalloon = String(parameters['displayAutoBalloon']);
  var shadowOpacity = Number(parameters['shadowOpacity']);
  displayAutoBalloon = false;
  
Lmd.MrLiu_AutoBalloon.Game_Character_initialize = Game_Character.prototype.initialize;
  Game_Character.prototype.initialize = function() {
    Lmd.MrLiu_AutoBalloon.Game_Character_initialize.call(this);
    this._auto_balloon = 0;
};

Game_Character.prototype._auto_balloon = function() {
        return this._auto_balloon;
};

  
Lmd.MrLiu_AutoBalloon.Game_Event_refresh = Game_Event.prototype.refresh;
Game_Event.prototype.refresh = function() {
        Lmd.MrLiu_AutoBalloon.Game_Event_refresh.call(this);
        if((this._erased == false)&&(this._trigger == 0)){
        var list = this.list();
        for(var i=0 ;i<list.length;i++){
                if (list.code == 108){
                        var num =list.parameters[0].match(/autoballoon_(\d+)/g);
                        if (num){
                                var num1 = Number((String(num)).match(/\d+(\.\d+)?/g));
                                this._auto_balloon = num1;
                        }
                }
        }
        }
};

Game_Event.prototype.setupPage = function() {
    if (this._pageIndex >= 0) {
                this._auto_balloon = 0;
        this.setupPageSettings();
    } else {
                this._auto_balloon = 0;
        this.clearPageSettings();
    }
    this.refreshBushDepth();
    this.clearStartingFlag();
    this.checkEventTriggerAuto();
};




  
  
Lmd.MrLiu_AutoBalloon.Sprite_Character_initialize = Sprite_Character.prototype.initialize;
Sprite_Character.prototype.initialize = function(character) {
    Lmd.MrLiu_AutoBalloon.Sprite_Character_initialize.call(this,character);
        this.createAutoBalloon();
        this._dis_flag = 0;
        this._flag = 0;
        this._bx = 0
        this.character = character;
};
Sprite_Character.prototype.createAutoBalloon = function() {
    this._auto_balloon_sprite = new Sprite();
    this._auto_balloon_sprite.bitmap = ImageManager.loadSystem('Balloon_1');
        this._auto_balloon_sprite.opacity = 0;
        this._auto_balloon_sprite.z = 7;
        this._auto_balloon_sprite.x = this.x;
    this._auto_balloon_sprite.y = this.y-40;//-this.patternHeight();// ;//- this.height*2;
        this._auto_balloon_sprite.anchor.x = 0.5;
    this._auto_balloon_sprite.anchor.y = 1;
        //this.addChild(this._auto_balloon_sprite);
    this.addChild(this._auto_balloon_sprite);
        if (displayAutoBalloon){
                this._p_balloon_sprite = new Sprite();
                this._p_balloon_sprite.bitmap = ImageManager.loadSystem('Balloon_1');
                this._p_balloon_sprite.opacity = 0;
                this._p_balloon_sprite.z = 7;
                this.parent.addChild(this._p_balloon_sprite);//this.addChild(this._p_balloon_sprite);
        }
}       

Lmd.MrLiu_AutoBalloon.Sprite_Character_update = Sprite_Character.prototype.update;
Sprite_Character.prototype.update = function() {
        Lmd.MrLiu_AutoBalloon.Sprite_Character_update.call(this);
        if ((this.character._auto_balloon == 0)  || ! (this._balloonDuration == 0 ) || ($gameMap._interpreter.isRunning()) || ($gameSwitches[212] == true)){
      this.clear_auto_balloon();
        }
    else{
      this.update_auto_balloon();
        }
}


Sprite_Character.prototype.face_to_event = function() {
    var data = new Array();
    var w = 1;
    var h = 1 * 2;
        for (var i=0;i<(h+1);i++)
        {
                for (var j=0;j<(h+1);j++)
                        {
                            data.push([(this.character.x-w)+i,(this.character.y-w)+j]);
                        }
        }
         for(var i =0;i<data.length;i++) {
     if((String(data)) == (String([$gamePlayer.x , $gamePlayer.y]))) {
      return true;
     }
    }
        return false;
}


Sprite_Character.prototype.distance_balloom_opacity = function() {
   this._auto_balloon_sprite.opacity += 70;
    if (displayAutoBalloon){
      this._p_balloon_sprite.opacity += 70;
        }
}


Sprite_Character.prototype.clear_auto_balloon = function() {
        if (this._auto_balloon_sprite.opacity == 0){
      this._dis_flag = 255;
      return;
        }
    this._auto_balloon_sprite.opacity = this._dis_flag;
    if (displayAutoBalloon){
      this._p_balloon_sprite.opacity = this._dis_flag;
        }
    this._dis_flag -= 35;
}



Sprite_Character.prototype.start_auto_balloon = function() {
    this._flag = 1;
    this._balloon_id = this.character._auto_balloon;
    this._ry = (this.character._auto_balloon - 1) * 32;
}

Sprite_Character.prototype.set_rect = function(index) {
    this._auto_balloon_sprite.setFrame(32 * index, this._ry, 32, 32);
    if (displayAutoBalloon){
      this._p_balloon_sprite.setFrame(32 * index, this._ry, 32, 32);
        }
}



Sprite_Character.prototype.update_auto_balloon = function() {
    if ((!this._auto_balloon_sprite) ||  (this._balloon_id != this._character._auto_balloon) || (this._flag == 0)){
          this.start_auto_balloon();
    }
        //console.log(this.height);
        //console.log(this.character.y);
        //this._auto_balloon_sprite.y = this.character.y - this.height;
        //console.log(this._auto_balloon_sprite.y);
    if (displayAutoBalloon){
                this._p_balloon_sprite.x = $gamePlayer.x;
        this._p_balloon_sprite.y = $gamePlayer.y;
        }
    if (this.face_to_event()){
      this.distance_balloom_opacity();
        }else{
      this.clear_auto_balloon();
        }
    if (this._flag == 10){
      this._flag = 0;
          if(this._bx == 2){
                  this._bx = 0;
          }
          else{
                  this._bx++;
          }
        }
    else{
      this._flag++;
        }
        this.set_rect(this._bx);
}
[/pre]

MrLiu_AutoBalloon.rar

1.93 KB, 下载次数: 1292

评分

参与人数 11星屑 +425 梦石 +2 赞 +5 收起 理由
FriendsMind + 1 我好喜歡你做的插件!
plain666 + 1 塞糖
Kim_Shyuen + 1 精品文章
abr80210 + 1 我很赞同
simyaoyao + 1 塞糖
c248611 + 45 塞糖
夜$神 + 42 Mark,好插件
king + 96 塞糖
余烬之中 + 166 + 2 图书馆收录
rpg-sheep + 10 666

查看全部评分

本人三无老人,请大神轻拍
梦石
0
星屑
50
在线时间
248 小时
注册时间
2010-8-22
回帖
105
发表于 2015-11-20 19:23:11 | 显示全部楼层
VA 版的 Balloon
Balloon_1.png
回复

使用道具 举报

职业の水客

梦石
2
星屑
16976
在线时间
7495 小时
注册时间
2010-6-16
回帖
3461

极短27评委MZ评测员极短26评委开拓者

发表于 2015-11-20 19:41:19 | 显示全部楼层
真是不错的插件
一个看图的地方
群爆炸重建后状态:论坛老人最多(只剩下了活跃的老人),技术力很强(依旧不变)的编程灌水群:901540785
专门讨论RM相关的Q群:56875149
PS:第一个群不是专门讨论RM的,第二个才是哦。
回复

使用道具 举报

百合控

梦石
0
星屑
6548
在线时间
1275 小时
注册时间
2013-8-21
回帖
3522

开拓者

发表于 2015-11-20 20:32:13 | 显示全部楼层
我看楼主很有前途
(其实并不需要我说= =
萌新瑟瑟发抖
看到我请叫我去干活
回复

使用道具 举报

梦石
0
星屑
3113
在线时间
766 小时
注册时间
2008-7-5
回帖
715
发表于 2015-11-21 10:12:38 | 显示全部楼层
支持云烟君!!
阿姨我还未填平坑.....
自己是“擅长美工的笨蛋策划在干着程序的活”
  
回复

使用道具 举报

名侦探小柯

梦石
10
星屑
4393
在线时间
3739 小时
注册时间
2006-9-6
回帖
36595

极短27获奖MZ评测员开拓者贵宾第3届短篇游戏大赛主流游戏组亚军第5届短篇游戏比赛亚军

发表于 2015-11-21 10:37:07 | 显示全部楼层
很棒的插件,有些时候NPC很多,可以使其中重要的NPC凸现出来
不定期回归 ~ 游戏开发之旅
———————————————————————————————
回复

使用道具 举报

姬魂

梦石
0
星屑
443
在线时间
400 小时
注册时间
2009-8-30
回帖
568

开拓者

发表于 2015-11-21 12:49:04 | 显示全部楼层
好溜
回复

使用道具 举报

梦石
0
星屑
50
在线时间
64 小时
注册时间
2014-3-20
回帖
12
发表于 2015-11-23 06:18:40 | 显示全部楼层
这个效果做的很不错!32个赞
回复

使用道具 举报

梦石
0
星屑
689
在线时间
2 小时
注册时间
2015-11-24
回帖
2
发表于 2015-11-24 22:07:27 | 显示全部楼层
请收下我的膝盖
回复

使用道具 举报

梦石
0
星屑
1697
在线时间
16 小时
注册时间
2014-7-27
回帖
4
发表于 2015-11-26 13:24:51 | 显示全部楼层
感谢分享。感觉很棒。
W
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部