jerry2810

VerticalBars

Nov 4th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // VerticalBars.js
  3. //=============================================================================
  4. //v1.1 Special Version that goes positive and negative.
  5. /*:
  6.  * @plugindesc Makes bars yo!
  7.  * @author Jeremy Cannady
  8.  *
  9.  * @default true
  10.  * @help Cool bars!
  11.  *
  12. */
  13.  
  14. (function(){
  15.  
  16. function Battle_Tp_Bar() { this.initialize.apply(this, arguments); }
  17. Battle_Tp_Bar.prototype = Object.create(Window_Base.prototype);
  18. Battle_Tp_Bar.prototype.constructor = Battle_Tp_Bar;
  19.  
  20. Battle_Tp_Bar.prototype.initialize = function(x, y, width, height) {
  21.     Window_Base.prototype.initialize.call(this, x, y, width, height);
  22.     this.deactivate();
  23.     this.update();
  24. };
  25.  
  26. Battle_Tp_Bar.prototype.update = function() {
  27.     Window_Base.prototype.update.call(this);
  28.     this.contents.clear();
  29.     //x, y, width
  30.     this.drawTp(0, 0, 300);
  31. };
  32.  
  33. Battle_Tp_Bar.prototype.drawTp = function(x, y, width) {
  34.     var b1maxValue = Game_BattlerBase.prototype.maxTp();
  35.     var b1CurrentValue = $gameParty.members()[0].tp;
  36.     var b1rate = b1CurrentValue/b1maxValue;
  37.     var b1rateDecimal = (b1rate*10) % 1;
  38.  
  39.     this.opacity = 0;
  40.     var color1 = this.textColor(30);
  41.     var color2 = this.textColor(30);
  42.    
  43.     if(b1rate == 1.0){this.drawText('10', 720 , 55 , 75, 'left');};
  44.     if(b1rate > 0.9 ){this.drawText('9', 720 , 85 , 75, 'left');};
  45.     if(b1rate > 0.8){this.drawText('8', 720 , 115 , 75, 'left');};
  46.     if(b1rate > 0.7){this.drawText('7', 720 , 145 , 75, 'left');};
  47.     if(b1rate > 0.6){this.drawText('6', 720 , 175 , 75, 'left');}  
  48.     if(b1rate > 0.5){this.drawText('5', 720 , 205 , 75, 'left');};
  49.     if(b1rate > 0.4){this.drawText('4', 720 , 235 , 75, 'left');};
  50.     if(b1rate > 0.3){this.drawText('3', 720 , 265 , 75, 'left');};
  51.     if(b1rate > 0.2){this.drawText('2', 720 , 295 , 75, 'left');};
  52.     if(b1rate > 0.1){this.drawText('1', 720 , 325 , 75, 'left');};
  53.    
  54.     this.drawText(Math.floor(b1rate*10), 750 , 350 , 75, 'left');
  55.     this.drawText('TP', 750 , 375 , 75, 'left');
  56.  
  57.     if(b1rateDecimal == 0 && b1rate > 0){
  58.         this.drawTpGauge(x, y, width, 1, color1, color2);
  59.     }else{
  60.         this.drawTpGauge(x, y, width, b1rateDecimal , color1, color2);
  61.     }
  62.  };
  63.  
  64. Window_Base.prototype.drawTpGauge = function(x, y, width, rate, color1, color2) {
  65.     var fillH = Math.floor(width * rate);
  66.     this.contents.fillRect(750, 50, 30, width, this.gaugeBackColor());
  67.     this.contents.gradientFillRect(750, 50+width-fillH, 30, fillH, color1, color2, true);
  68. };
  69.  
  70. Scene_Battle.prototype.createTpBar = function() {
  71.     this.TpBar = new Battle_Tp_Bar(0, 0, 816, 624);
  72.     this.addChild(this.TpBar);
  73. };
  74.  
  75. var battleWindows = Scene_Battle.prototype.createAllWindows;
  76. Scene_Battle.prototype.createAllWindows = function() {
  77.     battleWindows.call(this)
  78.     this.createTpBar();
  79. };
  80. })();
Advertisement
Add Comment
Please, Sign In to add comment