查看: 2885|回复: 1

[已经解决] 这个状态插件如何改坐标

[复制链接]
梦石
0
星屑
50
在线时间
491 小时
注册时间
2015-1-7
回帖
110
发表于 2015-12-26 20:25:48 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 西姐 于 2015-12-26 20:28 编辑

我想把它改成这样的 未标题-1.png

我想把人物的立绘带入变量,我之前VA搞过,XX+变量显示立绘,这样可以让玩家选择自己想要的立绘。。

  1. //=============================================================================
  2. // MrTS_LuminusStatus.js
  3. //=============================================================================

  4. /*:
  5. * @plugindesc Luminus Status Screen. Changes how data is displayed there.
  6. * @author Mr. Trivel
  7. *
  8. * @param Short Attack
  9. * @desc Short text for Attack
  10. * Default: ATK
  11. * @default ATK
  12. *
  13. * @param Short Defense
  14. * @desc Short text for Defense
  15. * Default: DEF
  16. * @default DEF
  17. *
  18. * @param Short MAttack
  19. * @desc Short text for Magical Attack
  20. * Default: MAT
  21. * @default MAT
  22. *
  23. * @param Short MDefense
  24. * @desc Short text for MDefense
  25. * Default: MDF
  26. * @default MDF
  27. *
  28. * @param Short Agility
  29. * @desc Short text for Agility
  30. * Default: AGI
  31. * @default AGI
  32. *
  33. * @param Short Luck
  34. * @desc Short text for Luck
  35. * Default: LUK
  36. * @default LUK
  37. *
  38. * @help
  39. * --------------------------------------------------------------------------------
  40. * Free for non commercial use.
  41. * Version 1.0
  42. * --------------------------------------------------------------------------------
  43. *
  44. * --------------------------------------------------------------------------------
  45. * Required Files
  46. * --------------------------------------------------------------------------------
  47. * "img\system\LuminusBackground.png" - At least as big as screen. Background.
  48. * "img\system\LuminusStatus.png" - 348x539 - Background for stats and equipment.
  49. * "img\system\LuminusBar.png" - 324x48 - background for equipment.
  50. * "img\system\LuminusSeparator.png" - 327x9 - separator bar between blocks.
  51. * "img\system\LuminusStatusName.png" - 264x70 - Status Scene name in top right.
  52. * "img\system\LuminusActor#.png" - any preferred size. # - Actor ID
  53. *    E.g. LuminusActor5.png would be actor's with ID 5 image.
  54. * "img\system\LuminusBottomBar.png" - 40height, width - as big as screen.
  55. *    Is at the very bottom of status screen. Can be used to display controls.
  56. *
  57. *
  58. * --------------------------------------------------------------------------------
  59. * Map Tags
  60. * --------------------------------------------------------------------------------
  61. * <LuminusBackground: [FILENAME]>
  62. * Luminus Status Scene background is set depending on the map you're in.
  63. * If no tag set it uses default background - "LuminusBackground".
  64. * --------------------------------------------------------------------------------
  65. * Version History
  66. * --------------------------------------------------------------------------------
  67. * 1.0 - Release
  68. */

  69. (function() {

  70.         var parameters = PluginManager.parameters('MrTS_LuminusStatus');
  71.         var paramATK  = String(parameters['Short Attack']         || "ATK")
  72.         var paramDEF  = String(parameters['Short Defense']         || "DEF")
  73.         var paramMATK = String(parameters['Short MAttack']         || "MAT")
  74.         var paramMDEF = String(parameters['Short MDefense'] || "MDF")
  75.         var paramAGI  = String(parameters['Short Agility']         || "AGI")
  76.         var paramLUK  = String(parameters['Short Luck']         || "LUK")

  77.         Scene_Status.prototype.create = function() {
  78.             Scene_MenuBase.prototype.create.call(this);
  79.             this._statusWindow = new Window_Status();
  80.             this._statusWindow.setHandler('cancel',   this.popScene.bind(this));
  81.             this._statusWindow.setHandler('pagedown', this.nextActor.bind(this));
  82.             this._statusWindow.setHandler('pageup',   this.previousActor.bind(this));
  83.             this.addWindow(this._statusWindow);
  84.             this.refreshActor();
  85.         };

  86.         Scene_Status.prototype.createBackground = function() {
  87.             this._backgroundSprite = new Sprite();
  88.             if ($dataMap.meta.LuminusBackground)
  89.             {
  90.                     var fileName = String($dataMap.meta.LuminusBackground);
  91.                     if (fileName[0] == " ") fileName = fileName.substring(1);
  92.                     this._backgroundSprite.bitmap = ImageManager.loadSystem(fileName);
  93.             }
  94.             else
  95.                     this._backgroundSprite.bitmap = ImageManager.loadSystem("LuminusBackground");
  96.             this.addChild(this._backgroundSprite);

  97.             this._statusBackground = new Sprite();
  98.             this._statusBackground.bitmap = ImageManager.loadSystem("LuminusStatus");
  99.             this._statusBackground.x = 30;
  100.             this._statusBackground.y = Graphics.boxHeight/2 - 540/2;
  101.             this.addChild(this._statusBackground);

  102.             this._actorSprite = new Sprite()
  103.             this.addChild(this._actorSprite);

  104.             this._barSprites = [];
  105.             var equips = $gameActors.actor(1).equips();
  106.             for (var i = 0; i < equips.length; i++) {
  107.                     var sprite = new Sprite();
  108.                     sprite.bitmap = ImageManager.loadSystem("LuminusBar");
  109.                     sprite.x = this._statusBackground.x + 9;
  110.                     sprite.y = this._statusBackground.y + 250 + 48*i;
  111.                         this.addChild(sprite);
  112.             };

  113.             this._bottomBarSprite = new Sprite();
  114.             this._bottomBarSprite.bitmap = ImageManager.loadSystem("LuminusBottomBar");
  115.             this._bottomBarSprite.y = Graphics.boxHeight - 40;
  116.             this.addChild(this._bottomBarSprite);

  117.             this._statusName = new Sprite();
  118.             this._statusName.bitmap = ImageManager.loadSystem("LuminusStatusName");
  119.             var sprite = this._statusName;
  120.             sprite.bitmap.addLoadListener(function() {
  121.                     sprite.x = Graphics.width - sprite.width;
  122.             });
  123.             this.addChild(this._statusName);
  124.         };

  125.         Scene_Status.prototype.refreshActor = function() {
  126.             var actor = this.actor();
  127.             this._statusWindow.setActor(actor);
  128.             var actorSprite = this._actorSprite;
  129.             var statusSprite = this._statusBackground;
  130.             
  131.             actorSprite.bitmap = ImageManager.loadSystem("LuminusActor" + actor.actorId());
  132.             actorSprite.bitmap.addLoadListener(function() {
  133.                     var w = Graphics.boxWidth - statusSprite.x - statusSprite.width;
  134.                     var x = statusSprite.x + statusSprite.width;
  135.                     var y = Graphics.boxHeight - actorSprite.height;
  136.                     if (y < 0) y = 0;
  137.                     actorSprite.x = x + w/2 - actorSprite.width/2;
  138.                     actorSprite.y = y;
  139.             });
  140.         };

  141.         Window_Status.prototype.initialize = function() {
  142.             var width = Graphics.boxWidth;
  143.             var height = Graphics.boxHeight;
  144.             Window_Selectable.prototype.initialize.call(this, 0, 0, width, height);
  145.             this.refresh();
  146.             this.activate();
  147.             this.opacity = 0;
  148.         };

  149.         Window_Status.prototype.refresh = function() {
  150.             this.contents.clear();

  151.             var positions = [];
  152.             var x = 30 - this.standardPadding();

  153.             if (this._actor) {
  154.                     var actor = this._actor;
  155.                 var lineHeight = this.lineHeight();
  156.                 
  157.                 var y = Graphics.boxHeight/2 - 540/2 - this.standardPadding() + 8;
  158.                 var mw = 348/2;
  159.                 this.drawText(TextManager.levelA, x + 9, y);
  160.                 this.drawText(actor.level, x, y, mw - 6, 'right');
  161.                 this.drawText(actor.name(), x + mw, y, mw, 'center');

  162.                 y += lineHeight;
  163.                 this.drawText(TextManager.exp, x + 9, y, mw - 6);
  164.                 var exp = (actor.currentExp()-actor.currentLevelExp()) + "/" + (actor.nextLevelExp()-actor.currentLevelExp());
  165.                 this.drawText(exp, x, y, mw*2-12, 'right');

  166.                 y += lineHeight;
  167.                 this.drawText(TextManager.hpA, x + 9, y);
  168.                 var hp = actor.hp + "/" + actor.mhp;
  169.                 var whp = this.textWidth(hp);
  170.                 this.drawText(hp, x, y, mw - 6, 'right');
  171.                 this.drawText(TextManager.mpA, x + mw + 6, y);
  172.                 var mp = actor.mp + "/" + actor.mmp;
  173.                 this.drawText(mp, mw, y, mw, 'right');

  174.                 y += lineHeight;
  175.                 positions.push(y)
  176.                 
  177.                 y += lineHeight/3;
  178.                 var sw = mw  - this.textWidth(paramATK);
  179.                 var swx = this.textWidth(paramATK);
  180.                 this.drawText(paramATK, x + 9, y);
  181.                 this.drawText(actor.atk, x + swx, y, sw, 'center');
  182.                 this.drawText(paramDEF, x + mw + 6, y);
  183.                 this.drawText(actor.def, mw + swx, y, sw, 'center');

  184.                 y += lineHeight;
  185.                 this.drawText(paramMATK, x + 9, y);
  186.                 this.drawText(actor.mat, x + swx, y, sw, 'center');
  187.                 this.drawText(paramMDEF, x + mw + 6, y);
  188.                 this.drawText(actor.mdf, mw + swx, y, sw, 'center');

  189.                 y += lineHeight;
  190.                 this.drawText(paramAGI, x + 9, y);
  191.                 this.drawText(actor.agi, x + swx, y, sw, 'center');
  192.                 this.drawText(paramLUK, x + mw + 6, y);
  193.                 this.drawText(actor.luk, mw + swx, y, sw, 'center');

  194.                 y += lineHeight;
  195.                 positions.push(y);

  196.                 y += lineHeight/3+2;
  197.                 var equips = this._actor.equips();
  198.                     var count = Math.min(equips.length, this.maxEquipmentLines());
  199.                     for (var i = 0; i < count; i++) {
  200.                             this.drawItemName(equips[i], x + 18, y + 48 * i + 6);
  201.                     }
  202.             }

  203.             var bitmapSeparator = ImageManager.loadSystem("LuminusSeparator");
  204.             var c = this.contents;
  205.             bitmapSeparator.addLoadListener(function() {
  206.                     for (var i = 0; i < positions.length; i ++)
  207.                             c.blt(bitmapSeparator, 0, 0, bitmapSeparator.width, bitmapSeparator.height, x + 9, positions[i]);
  208.             });
  209.         };

  210.         Window_Status.prototype.drawVertLine = function(x) {
  211.             this.contents.paintOpacity = 48;
  212.             this.contents.fillRect(x, 0, 2, this.contentsHeight(), this.lineColor());
  213.             this.contents.paintOpacity = 255;
  214.         };
  215. })();
复制代码
梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2015-12-26 20:38:15 | 显示全部楼层
  actorSprite.bitmap = ImageManager.loadSystem("LuminusActor" + actor.actorId());
            actorSprite.bitmap.addLoadListener(function() {
                    var w = Graphics.boxWidth - statusSprite.x - statusSprite.width;
                    var x = statusSprite.x + statusSprite.width;
                    var y = Graphics.boxHeight - actorSprite.height;
                    if (y < 0) y = 0;
                    actorSprite.x = x + w/2 - actorSprite.width/2;
                    actorSprite.y = y;
            });
这一句?

点评

多谢,刚发完帖子,我就搜到怎么带入变量了。。。。  发表于 2015-12-26 20:54

评分

参与人数 1梦石 +1 收起 理由
余烬之中 + 1 /w\

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部