Advertisement
jerry2810

Map_Bars

Nov 2nd, 2015
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Map_Bars.js
  3. //=============================================================================
  4. //v1.0
  5. /*:
  6.  * @plugindesc Makes bars yo!
  7.  * @author Jeremy Cannady
  8.  *
  9.  * @param Bar 1 X starting
  10.  * @desc Select x position.
  11.  * @default 0
  12.  *
  13.  * @param Bar 1 Y starting
  14.  * @desc Select the y position.
  15.  * @default 0
  16.  *
  17.  * @param Bar 1 Width
  18.  * @desc Select the width.
  19.  * @default 100
  20.  *
  21.  * @param Bar 1 Height
  22.  * @desc Select the height.
  23.  * @default 50
  24.  *
  25.  * @param Bar 1 color 1
  26.  * @desc Select the color.
  27.  * @default 30
  28.  *
  29.  * @param Bar 1 color 2
  30.  * @desc Select the color.
  31.  * @default 30
  32.  *
  33.  * @param Bar 1 Text x
  34.  * @desc Select the x.
  35.  * @default 0
  36.  *
  37.  * @param Bar 1 Text y
  38.  * @desc Select the y.
  39.  * @default 0
  40.  *
  41.  * @param Bar 1 Enabled
  42.  * @desc On True or false.
  43.  * @default true
  44.  *
  45.  * @help Cool bars!
  46.  *
  47. */
  48. (function(){
  49. var parameters = PluginManager.parameters('Map_Bars');
  50. var bar1Enabled = parameters['Bar 1 Enabled'];
  51. var bar1x = parseInt(parameters['Bar 1 X starting']);
  52. var bar1y = parseInt(parameters['Bar 1 Y starting']);
  53. var bar1w = parseInt(parameters['Bar 1 Width']);
  54. var bar1h = parseInt(parameters['Bar 1 Height']);
  55. var b1c1 = parseInt(parameters['Bar 1 color 1']);
  56. var b1c2 = parseInt(parameters['Bar 1 color 2']);
  57. var b1tx = parseInt(parameters['Bar 1 Text x']);
  58. var b1ty = parseInt(parameters['Bar 1 Text y']);
  59.  
  60. function Map_Bar1() { this.initialize.apply(this, arguments); }
  61. Map_Bar1.prototype = Object.create(Window_Base.prototype);
  62. Map_Bar1.prototype.constructor = Map_Bar1;
  63.  
  64. Map_Bar1.prototype.initialize = function(x, y, width, height) {
  65.     Window_Base.prototype.initialize.call(this, x, y, width, height);
  66.     this._helpWindow = null;
  67.     this._handlers = {};
  68.     this._touching = false;
  69.     this.deactivate();
  70.     this.update();
  71. };
  72.  
  73. Map_Bar1.prototype.update = function() {
  74.     Window_Base.prototype.update.call(this);
  75.     this.contents.clear();
  76.     this.drawBar1( bar1x-16, bar1y-16, bar1w);
  77. };
  78.  
  79. Map_Bar1.prototype.drawBar1 = function( x, y, width) {
  80.     this.opacity = 0;
  81.     this.makeFontSmaller();
  82.     var color1 = this.textColor(b1c1);
  83.     var color2 = this.textColor(b1c2);
  84.     this.drawGauge1(bar1x, bar1y, width+32, 100 / 300 , color1, color2);
  85.     this.drawText('var/varMax', b1tx , b1ty, width, 'center');
  86.  };
  87.  Window_Base.prototype.drawGauge1 = function(x, y, width, rate, color1, color2) {
  88.     var fillW = Math.floor(width * rate);
  89.     var gaugeY = bar1h + this.lineHeight() - 8;
  90.     this.contents.fillRect(x, y, width, bar1h, this.gaugeBackColor());
  91.     this.contents.gradientFillRect(x, y, fillW, bar1h, color1, color2);
  92. };
  93.  
  94. var alias_SceneMapOnMapLoaded = Scene_Map.prototype.onMapLoaded;
  95. Scene_Map.prototype.onMapLoaded = function() {
  96.     alias_SceneMapOnMapLoaded.apply(this, arguments);
  97. };
  98.  
  99. Scene_Map.prototype.createBar1 = function() {
  100. this.Bar1 = new Map_Bar1(0, 0, 816, 624);
  101. this.addChild(this.Bar1);
  102. };
  103.  
  104. var alias_createDisplayObjects= Scene_Map.prototype.createDisplayObjects;
  105. Scene_Map.prototype.createDisplayObjects = function() {
  106. alias_createDisplayObjects.call(this);
  107.     if(bar1Enabled == 'true'){
  108.         this.createBar1();
  109.     };
  110. };
  111. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement