设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 31642|回复: 64

[原创发布] 【插件】仿碧轨地图血条

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3657
在线时间
4466 小时
注册时间
2008-6-12
帖子
802
发表于 2015-11-21 20:15:30 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 过眼云烟 于 2015-11-21 20:11 编辑

没错,我又回来了,发布新的插件。基本算是日更了,哈哈哈。

这次是模仿碧轨,或者说模仿Va中大家喜闻乐见经常用的仿碧轨血条,不过我并没有像VA大神那样直接用默认图片生成。
用法的话需要各位自己处理,然后放到Faces目录下,不过也很简单,附件中有一个PSD文件,只需要把图片进行简单处理即可。
图片大小为72*72。在地图有对话发生和打开你的默认开关的时候,血条会消失。后续版本我会完善更多功能的,enjoy it~~
(附件包括四个猪角头像文件,插件,和PSD图层)

效果如下:
仿碧轨地图血条.png

图片样式:(参考)
Actor1_face.png


注意:我的插件你可以随意用在非商业游戏中,如果需要用在商业游戏,需要联系我。
如果我的插件用在您的游戏中,请在致谢名单中提及,谢谢!



JAVASCRIPT 代码复制下载
  1. //=============================================================================
  2. // MrLiu_MapStatus.js
  3. //=============================================================================
  4. /*:
  5. * @plugindesc 在RMMV游戏的题图界面中显示仿空轨人物血条.
  6. * @author MrLiu-过眼云烟
  7.  * @param NotShowSwitch
  8.  * @desc 开启此开关则不显示地图血条,多用于剧情等特殊场景。
  9.  * @default 50
  10.  *
  11. * @help 这是我开发的第四个或者说第五个MV插件,本来程序可以实现自动切图功能
  12. * 但是切图之后,在菜单界面下的人物图片也会被切割,所以只能麻烦您自行提供素材了。
  13. * 请讲您的游戏中想显示在地图上的人物图片放到Faces目录下,请以Actor1_face.png
  14. * 格式命名,其中1代表1号角色,其他的您不需要改变。在插件中您可以自动设置的开关,
  15. * 可以在一些特殊剧情的时候打开这个开关,地图血条将自动关闭。后续版本我会考虑陆续
  16. * 增添功能的。Enjoy it~~支持我就多回帖多送糖吧。
  17. */
  18.  
  19. Window_Base.prototype.drawGauge = function(x, y, width, rate, color1, color2) {
  20.     var fillW = Math.floor(width * rate);
  21.     var gaugeY = y + this.lineHeight() - 8;
  22.     this.contents.fillRect(x, gaugeY, width, 6, this.gaugeBackColor());
  23.     this.contents.gradientFillRect(x, gaugeY, fillW, 6, color1, color2);
  24. };
  25. Bitmap.prototype.outlineTrap1 = function(x, y, width, height, color1, color2) {
  26.                 var context = this._context;
  27.                 var grad = context.createLinearGradient(x, y, x + width, y);
  28.                 var startCoords = [];
  29.                 grad.addColorStop(0, color1);
  30.                 grad.addColorStop(1, color2);
  31.                 context.save();
  32.                 context.beginPath();
  33.                 startCoords = [x, y + height]
  34.                 context.moveTo(x, y + height)
  35.                 context.lineTo(x + height, y)
  36.                 context.lineTo(x + width, y)
  37.                 context.lineTo(x + width - height, y + height)
  38.                 context.lineTo(startCoords[0], startCoords[1])
  39.                 context.strokeStyle = grad;
  40.                 context.stroke();
  41.                 context.restore();
  42.                 this._setDirty();
  43.         };
  44.  
  45.         Bitmap.prototype.fillTrap = function(x, y, width, widthpart, height, color1, color2) {
  46.                 var context = this._context;
  47.                 var grad = context.createLinearGradient(x, y, x + width, y);
  48.                 grad.addColorStop(0, color1);
  49.                 grad.addColorStop(1, color2);
  50.                 context.save();
  51.                 context.beginPath();
  52.                 context.moveTo(x, y + height)
  53.                 context.lineTo(x + height, y)
  54.                 context.lineTo(x + width, y)
  55.                 context.lineTo(x + width - height, y + height)
  56.                 context.clip();
  57.                 context.fillStyle = grad;
  58.                 context.fillRect(x, y, widthpart, height);
  59.                 context.restore();
  60.                 this._setDirty();
  61.         }
  62.  
  63.         Bitmap.prototype.outlineTrap = function(x, y, width, height, color1, color2) {
  64.                 var context = this._context;
  65.                 var grad = context.createLinearGradient(x, y, x + width, y);
  66.                 var startCoords = [];
  67.                 grad.addColorStop(0, color1);
  68.                 grad.addColorStop(1, color2);
  69.                 context.save();
  70.                 context.beginPath();
  71.                 startCoords = [x, y + height]
  72.                 context.moveTo(x, y + height)
  73.                 context.lineTo(x + height, y)
  74.                 context.lineTo(x + width, y)
  75.                 context.lineTo(x + width - height, y + height)
  76.                 context.lineTo(startCoords[0], startCoords[1])
  77.                 context.strokeStyle = grad;
  78.                 context.stroke();
  79.                 context.restore();
  80.                 this._setDirty();
  81.         }
  82.  
  83. function Window_MapStatus() {
  84.     this.initialize.apply(this, arguments);
  85. }
  86. var parameters = PluginManager.parameters('MrLiu_MapStatus');
  87. var notShowSwitch = Number(parameters['NotShowSwitch']);
  88.  
  89. Window_MapStatus.prototype = Object.create(Window_Selectable.prototype);
  90. Window_MapStatus.prototype.constructor = Window_MapStatus;
  91.  
  92. Window_MapStatus.prototype.initialize = function(x, y) {
  93.     var width = this.windowWidth();
  94.     var height = this.windowHeight();
  95.     Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  96.     this._formationMode = false;
  97.     this._pendingIndex = -1;
  98.     this.loadImages();
  99.     this._last_hps =  new Array();
  100.     this._last_mps =  new Array();
  101.     this._last_tps =  new Array();
  102.         this._hps =  new Array();
  103.         this._mps =  new Array();
  104.         this._tps =  new Array();
  105.     this.refresh();
  106. };
  107.  
  108. Window_MapStatus.prototype.drawGauge= function(x, y, width, rate, color1, color2) {
  109.                 var fillW = Math.floor(width * rate);
  110.                 var gaugeY = y + this.lineHeight() - 12;
  111.                 this.contents.fillTrap(x, gaugeY, width, width, 5, this.textColor(19), this.textColor(19));
  112.                 this.contents.fillTrap(x, gaugeY, width, fillW, 5, color1, color2);
  113.                 this.contents.outlineTrap1(x, gaugeY, width, 5, "#000000", "#000000");       
  114. };
  115.  
  116. Window_MapStatus.prototype.maxItems = function() {
  117.     return $gameParty.size();
  118. };
  119.  
  120. Window_MapStatus.prototype.itemHeight = function() {
  121.     var clientHeight = this.height - this.padding * 2;
  122.     return Math.floor(clientHeight / this.numVisibleRows());
  123. };
  124.  
  125.  
  126. Window_MapStatus.prototype.loadImages = function() {
  127.     $gameParty.members().forEach(function(actor) {
  128.         ImageManager.loadFace(actor.faceName());
  129.     }, this);
  130. };
  131.  
  132. Window_MapStatus.prototype.drawItem = function(index) {
  133.     this.drawItemBackground(index);
  134.     this.drawItemImage(index);
  135.     this.drawItemStatus(index);
  136. };
  137.  
  138. Window_MapStatus.prototype.drawItemBackground = function(index) {
  139.     if (index === this._pendingIndex) {
  140.         var rect = this.itemRect(index);
  141.         var color = this.pendingColor();
  142.         this.changePaintOpacity(false);
  143.         this.contents.fillRect(rect.x, rect.y, rect.width, rect.height, color);
  144.         this.changePaintOpacity(true);
  145.     }
  146. };
  147.  
  148.  
  149.  
  150. Window_MapStatus.prototype.processOk = function() {
  151.     Window_Selectable.prototype.processOk.call(this);
  152.     $gameParty.setMenuActor($gameParty.members()[this.index()]);
  153. };
  154.  
  155. Window_MapStatus.prototype.isCurrentItemEnabled = function() {
  156.     if (this._formationMode) {
  157.         var actor = $gameParty.members()[this.index()];
  158.         return actor && actor.isFormationChangeOk();
  159.     } else {
  160.         return true;
  161.     }
  162. };
  163.  
  164. Window_MapStatus.prototype.selectLast = function() {
  165.     this.select($gameParty.menuActor().index() || 0);
  166. };
  167.  
  168. Window_MapStatus.prototype.formationMode = function() {
  169.     return this._formationMode;
  170. };
  171.  
  172. Window_MapStatus.prototype.setFormationMode = function(formationMode) {
  173.     this._formationMode = formationMode;
  174. };
  175.  
  176. Window_MapStatus.prototype.pendingIndex = function() {
  177.     return this._pendingIndex;
  178. };
  179.  
  180. Window_MapStatus.prototype.setPendingIndex = function(index) {
  181.     var lastPendingIndex = this._pendingIndex;
  182.     this._pendingIndex = index;
  183.     this.redrawItem(this._pendingIndex);
  184.     this.redrawItem(lastPendingIndex);
  185. };
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Window_MapStatus.prototype.windowWidth = function() {
  196.         return Graphics.boxWidth * 0.7;
  197.     };
  198.  
  199.     Window_MapStatus.prototype.windowHeight = function() {
  200.         var h1 = this.fittingHeight(1);
  201.         var h2 = this.fittingHeight(2);
  202.         return Graphics.boxHeight - h1 - h2;
  203.     };
  204.  
  205.     Window_MapStatus.prototype.maxCols = function() {
  206.         return 4;
  207.     };
  208.  
  209.     Window_MapStatus.prototype.numVisibleRows = function() {
  210.         return 1;
  211.     };
  212.  
  213.     Window_MapStatus.prototype.drawItemImage = function(index) {
  214.         var actor = $gameParty.members()[index];
  215.         var rect = this.itemRectForText(index);
  216.         var w = Math.min(rect.width, 144);
  217.         var h = Math.min(rect.height, 144);
  218.         var lineHeight = this.lineHeight();
  219.         this.changePaintOpacity(actor.isBattleMember());
  220.         this.drawActorFace1(actor, rect.x, 380, w, h);//(actor, rect.x, rect.y + lineHeight * 2.5, w, h);
  221.         this.changePaintOpacity(true);
  222.     };
  223. Window_MapStatus.prototype.drawActorFace1 = function(actor, x, y, width, height) {
  224.     this.drawFace1(actor._actorId,  x, y, width, height);
  225.    };
  226. ImageManager.loadFace1 = function(filename, hue) {
  227.     return this.loadBitmap('img/faces/', 'Actor'+filename+'_face', hue, true);
  228. };
  229.  
  230.  
  231. Window_MapStatus.prototype.drawFace1 = function(faceName,  x, y, width, height) {
  232.     width = width || Window_Base._faceWidth;
  233.     height = height || Window_Base._faceHeight;
  234.     var bitmap1 = ImageManager.loadFace1(faceName);
  235.         var dx = Math.floor(x + Math.max(width - 144, 0) / 2);
  236.     var dy = Math.floor(y + Math.max(height - 144, 0) / 2);
  237.     this.contents.blt(bitmap1, 0, 0, 72, 72, dx, dy,72,72);//gradientFillRect ( x , y , width , height , color1 , color2 , vertical )
  238. };
  239.  
  240.  
  241.  
  242.  
  243. Window_MapStatus.prototype.drawActorFace = function(actor, x, y, width, height) {
  244.     this.drawFace(actor.faceName(), actor.faceIndex(), x, y, width, height);
  245.    };
  246. Window_MapStatus.prototype.drawFace = function(faceName, faceIndex, x, y, width, height) {
  247.     width = width || Window_Base._faceWidth;
  248.     height = height || Window_Base._faceHeight;
  249.     var bitmap1 = ImageManager.loadFace(faceName);
  250.     var pw = Window_Base._faceWidth;
  251.     var ph = Window_Base._faceHeight;
  252.     var sw = Math.min(width, pw);
  253.     var sh = Math.min(height, ph);
  254.     var dx = Math.floor(x + Math.max(width - pw, 0) / 2);
  255.     var dy = Math.floor(y + Math.max(height - ph, 0) / 2);
  256.     var sx = faceIndex % 4 * pw + (pw - sw) / 2;
  257.     var sy = Math.floor(faceIndex / 4) * ph + (ph - sh) / 2;
  258.     this.contents.blt(bitmap1, sx, sy, sw, sh, dx, dy,72,72);
  259.         this.clear_edge(bitmap1,sx,sy);
  260. };
  261.  
  262. Window_MapStatus.prototype.clear_edge = function(bitmap,sx,sy) {
  263.         for(var i=0 ;i<=72;i++){
  264.       bitmap.clearRect (sx, i+sy, 72 - i, 1);//72
  265.       bitmap.clearRect (sx+74 + i, i+sy, 72 - i, 1);
  266.       bitmap.clearRect (sx, i + 74+sy, i, 1);
  267.       bitmap.clearRect (sx+144 - i, i + 74+sy, i, 1);
  268.         }       
  269. };
  270.  
  271.     Window_MapStatus.prototype.drawItemStatus = function(index) {
  272.         var actor = $gameParty.members()[index];
  273.         var rect = this.itemRectForText(index);
  274.         var x = rect.x;
  275.         var y = rect.y;
  276.         var width = rect.width;
  277.         var bottom = y + rect.height-40;
  278.         var lineHeight = this.lineHeight();
  279.         this.drawActorHp(actor, x, bottom - lineHeight * 3, width);
  280.         this.drawActorMp(actor, x, bottom - lineHeight * 2, width);
  281.                 this.drawActorTp(actor, x, bottom - lineHeight * 1, width);
  282.     };
  283.  
  284.         Window_MapStatus.prototype.lineHeight = function() {
  285.        return 6;
  286.     };
  287.  
  288.  
  289.  
  290. Window_MapStatus.prototype.drawActorHp = function(actor, x, y, width) {
  291.     width = width || 186;
  292.     var color1 = this.hpGaugeColor1();
  293.     var color2 = this.hpGaugeColor2();
  294.     this.drawGauge(x+54, y, width-54, actor.hpRate(), color1, color2);
  295. };
  296.  
  297. Window_MapStatus.prototype.drawActorMp = function(actor, x, y, width) {
  298.     width = width || 186;
  299.     var color1 = this.mpGaugeColor1();
  300.     var color2 = this.mpGaugeColor2();
  301.     this.drawGauge(x+44, y, width-54, actor.mpRate(), color1, color2);
  302. };
  303.  
  304. Window_MapStatus.prototype.drawActorTp = function(actor, x, y, width) {
  305.     width = width || 96;
  306.     var color1 = this.tpGaugeColor1();
  307.     var color2 = this.tpGaugeColor2();
  308.     this.drawGauge(x+34, y, width-54, actor.tpRate(), color1, color2);
  309. };
  310.  
  311. Window_MapStatus.prototype.update = function() {
  312.   Window_Base.prototype.update.call(this);
  313.   this._hps.length = 0;
  314.   this._mps.length = 0;
  315.   this._tps.length = 0;
  316.   for(var el=0;el<$gameParty.size();el++){
  317.     this._hps.push($gameParty.members()[el].hpRate());
  318.         this._mps.push($gameParty.members()[el].mpRate());
  319.         this._tps.push($gameParty.members()[el].tpRate());
  320.   }
  321.    for(var i=0;i<this._hps.length;i++){
  322.     if (this._hps[i] != this._last_hps[i]){
  323.                 this.refresh();
  324.                 break;
  325.         }
  326.         if (this._mps[i] != this._last_mps[i]){
  327.                 this.refresh();
  328.                 break;
  329.         }
  330.         if (this._tps[i] != this._last_tps[i]){
  331.                 this.refresh();
  332.                 break;
  333.         }
  334.   }
  335. };
  336.  
  337. Window_MapStatus.prototype.refresh = function() {
  338.     this.contents.clear();
  339.         this.drawAllItems();
  340.         this._last_hps.length = 0;
  341.     this._last_mps.length = 0;
  342.     this._last_tps.length = 0;
  343. };
  344. Window_MapStatus.prototype.drawAllItems = function() {
  345.     var topIndex = this.topIndex();
  346.     for (var i = 0; i < this.maxPageItems(); i++) {
  347.         var index = topIndex + i;
  348.         if (index < this.maxItems()) {
  349.             this.drawItem(index);
  350.         }
  351.     }
  352.   for(var el=0;el<$gameParty.size();el++){
  353.     this._last_hps.push($gameParty.members()[el].hpRate());
  354.         this._last_mps.push($gameParty.members()[el].mpRate());
  355.         this._last_tps.push($gameParty.members()[el].tpRate());
  356.   }
  357. };       
  358.  
  359.  
  360.         var _Scene_Map_createMapStatusWindow = Scene_Map.prototype.createDisplayObjects;
  361.         Scene_Map.prototype.createDisplayObjects = function() {
  362.         _Scene_Map_createMapStatusWindow.call(this);
  363.         this._mapStatusWindow = new Window_MapStatus();
  364.         this._mapStatusWindow.opacity = 0;
  365.         this._mapStatusWindow.y = 150;
  366.         this.addWindow(this._mapStatusWindow);
  367.         };
  368.  
  369. var _Scene_Map_updateMapStatusWindow1 = Scene_Map.prototype.update;
  370. Scene_Map.prototype.update = function() {
  371.         _Scene_Map_updateMapStatusWindow1.call(this);////gameSwitches.value(dataId)
  372.         if(($gameMap._interpreter.isRunning()) || ($gameSwitches.value(notShowSwitch) == true)){
  373.  
  374.            this._mapStatusWindow.close();
  375.      }
  376.         else{
  377.            this._mapStatusWindow.open();  
  378.      }
  379. };

MrLiu_MapStatus.rar

78.63 KB, 下载次数: 2144

评分

参与人数 11星屑 +346 梦石 +2 +5 收起 理由
CC_gmaker + 1 塞糖
青衣blackcloth + 1 塞糖
永远的小萌新 + 1 我很赞同
龙影风 + 1 塞糖
2283258119 + 1 &lt;font style=&quot;vertical-align: inh
zjynew2 + 100 精品文章
邪月长啸 + 60 塞糖
柳岳枫 + 90 太帅了
余烬之中 + 66 + 1 图书馆收录
c248611 + 25 塞糖

查看全部评分

本人三无老人,请大神轻拍

Lv3.寻梦者

梦石
0
星屑
3078
在线时间
764 小时
注册时间
2008-7-5
帖子
760
发表于 2015-11-21 20:37:46 | 显示全部楼层
云烟君真是勤奋的劳模,继续支持
ps.我是群里的汽水~

点评

已经换了_(:3 」∠ )_然后发现不会摆弄js,卡在界面布局了  发表于 2015-11-23 21:28
快去换mv吧  发表于 2015-11-23 09:28
谢谢{:5_159:}  发表于 2015-11-21 20:41
阿姨我还未填平坑.....
自己是“擅长美工的笨蛋策划在干着程序的活”
  
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
388
在线时间
245 小时
注册时间
2011-11-20
帖子
324
发表于 2015-11-21 20:45:26 | 显示全部楼层
感谢大神贡献{:2_275:}
这里是个新人。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
2047
在线时间
9 小时
注册时间
2015-1-3
帖子
3
发表于 2015-11-21 20:47:37 | 显示全部楼层
在此膜拜大神,感谢分享\(≧▽≦)/
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
47 小时
注册时间
2014-8-19
帖子
12
发表于 2015-11-21 20:49:01 | 显示全部楼层
云烟出品,必须顶啊,无决来报道啦!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
55 小时
注册时间
2013-2-1
帖子
19
发表于 2015-11-21 20:51:19 | 显示全部楼层
来支持云烟酱拉!猜猜我是谁
回复 支持 反对

使用道具 举报

Lv2.观梦者

姬魂

梦石
0
星屑
423
在线时间
399 小时
注册时间
2009-8-30
帖子
612

开拓者

发表于 2015-11-21 21:03:36 | 显示全部楼层
前排支持~!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
79
在线时间
6 小时
注册时间
2006-7-10
帖子
76
发表于 2015-11-22 23:03:28 | 显示全部楼层
现在的rm mv的脚本用的是ruby还是javascript?

点评

javascript  发表于 2015-11-23 08:02
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
306 小时
注册时间
2014-8-5
帖子
416
发表于 2015-11-25 22:05:54 | 显示全部楼层
正好可以学习学习。最近做的那个HUD简直糟糕,只能绘制出位图,但是血蓝条却没有实际功能。

点评

十分期待后续的功能,猜想:1.在人物头像下方显示增益/异常状态的icon. 2.显示能量(TP)条。so on……  发表于 2015-11-25 22:09
  点我进入    
       ↓      
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
75
在线时间
75 小时
注册时间
2011-3-17
帖子
133
发表于 2015-11-26 18:38:38 | 显示全部楼层
哎哟,不错哦
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-17 01:03

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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