SHARE
TWEET

Map_Bars

jerry2810 Nov 1st, 2015 270 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.  * @help Cool bars!
  34.  *
  35. */
  36. (function(){
  37. var parameters = PluginManager.parameters('Map_Bars');
  38. var bar1x = parseInt(parameters['Bar 1 X starting']);
  39. var bar1y = parseInt(parameters['Bar 1 Y starting']);
  40. var bar1w = parseInt(parameters['Bar 1 Width']);
  41. var bar1h = parseInt(parameters['Bar 1 Height']);
  42. var b1c1 = parseInt(parameters['Bar 1 color 1']);
  43. var b1c2 = parseInt(parameters['Bar 1 color 2']);
  44.  
  45. function Map_Bar1() { this.initialize.apply(this, arguments); }
  46. Map_Bar1.prototype = Object.create(Window_Base.prototype);
  47. Map_Bar1.prototype.constructor = Map_Bar1;
  48.  
  49.  
  50. Map_Bar1.prototype.initialize = function(x, y, width, height) {
  51.     Window_Base.prototype.initialize.call(this, x, y, width, height);
  52.     this._helpWindow = null;
  53.     this._handlers = {};
  54.     this._touching = false;
  55.     this.deactivate();
  56.     this.update();
  57. };
  58.  
  59. Map_Bar1.prototype.update = function() {
  60.     Window_Base.prototype.update.call(this);
  61.     this.contents.clear();
  62.     this.drawBar1( bar1x-16, bar1y-16, bar1w);
  63. };
  64.  
  65. Map_Bar1.prototype.drawBar1 = function( x, y, width) {
  66.         this.opacity = 0;
  67.         this.makeFontSmaller();
  68.         var color1 = this.textColor(b1c1);
  69.     var color2 = this.textColor(b1c2);
  70.         this.drawGauge1(0, 0+32, width+32, 100 / 300 , color1, color2);
  71.         this.drawText('var/varMax', 0 , 0, width, 'center');
  72.  };
  73.  Window_Base.prototype.drawGauge1 = function(x, y, width, rate, color1, color2) {
  74.     var fillW = Math.floor(width * rate);
  75.     var gaugeY = bar1h + this.lineHeight() - 8;
  76.     this.contents.fillRect(x, y, width, bar1h, this.gaugeBackColor());
  77.     this.contents.gradientFillRect(x, y, fillW, bar1h, color1, color2);
  78. };
  79.  
  80. var alias_SceneMapOnMapLoaded = Scene_Map.prototype.onMapLoaded;
  81. Scene_Map.prototype.onMapLoaded = function() {
  82.     alias_SceneMapOnMapLoaded.apply(this, arguments);
  83. };
  84.  
  85. Scene_Map.prototype.createBar1 = function() {
  86. this.Bar1 = new Map_Bar1(bar1x, bar1y, bar1w+32, bar1h +32);
  87. this.addChild(this.Bar1);
  88. };
  89.  
  90. var alias_createDisplayObjects= Scene_Map.prototype.createDisplayObjects;
  91. Scene_Map.prototype.createDisplayObjects = function() {
  92. alias_createDisplayObjects.call(this);
  93. this.createBar1();
  94. };
  95. })();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top