Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // VerticalBars.js
- //=============================================================================
- //v1.1 Special Version that goes positive and negative.
- /*:
- * @plugindesc Makes bars yo!
- * @author Jeremy Cannady
- *
- * @default true
- * @help Cool bars!
- *
- */
- (function(){
- function Battle_Tp_Bar() { this.initialize.apply(this, arguments); }
- Battle_Tp_Bar.prototype = Object.create(Window_Base.prototype);
- Battle_Tp_Bar.prototype.constructor = Battle_Tp_Bar;
- Battle_Tp_Bar.prototype.initialize = function(x, y, width, height) {
- Window_Base.prototype.initialize.call(this, x, y, width, height);
- this.deactivate();
- this.update();
- };
- Battle_Tp_Bar.prototype.update = function() {
- Window_Base.prototype.update.call(this);
- this.contents.clear();
- //x, y, width
- this.drawTp(0, 0, 300);
- };
- Battle_Tp_Bar.prototype.drawTp = function(x, y, width) {
- var b1maxValue = Game_BattlerBase.prototype.maxTp();
- var b1CurrentValue = $gameParty.members()[0].tp;
- var b1rate = b1CurrentValue/b1maxValue;
- var b1rateDecimal = (b1rate*10) % 1;
- this.opacity = 0;
- var color1 = this.textColor(30);
- var color2 = this.textColor(30);
- if(b1rate == 1.0){this.drawText('10', 720 , 55 , 75, 'left');};
- if(b1rate > 0.9 ){this.drawText('9', 720 , 85 , 75, 'left');};
- if(b1rate > 0.8){this.drawText('8', 720 , 115 , 75, 'left');};
- if(b1rate > 0.7){this.drawText('7', 720 , 145 , 75, 'left');};
- if(b1rate > 0.6){this.drawText('6', 720 , 175 , 75, 'left');}
- if(b1rate > 0.5){this.drawText('5', 720 , 205 , 75, 'left');};
- if(b1rate > 0.4){this.drawText('4', 720 , 235 , 75, 'left');};
- if(b1rate > 0.3){this.drawText('3', 720 , 265 , 75, 'left');};
- if(b1rate > 0.2){this.drawText('2', 720 , 295 , 75, 'left');};
- if(b1rate > 0.1){this.drawText('1', 720 , 325 , 75, 'left');};
- this.drawText(Math.floor(b1rate*10), 750 , 350 , 75, 'left');
- this.drawText('TP', 750 , 375 , 75, 'left');
- if(b1rateDecimal == 0 && b1rate > 0){
- this.drawTpGauge(x, y, width, 1, color1, color2);
- }else{
- this.drawTpGauge(x, y, width, b1rateDecimal , color1, color2);
- }
- };
- Window_Base.prototype.drawTpGauge = function(x, y, width, rate, color1, color2) {
- var fillH = Math.floor(width * rate);
- this.contents.fillRect(750, 50, 30, width, this.gaugeBackColor());
- this.contents.gradientFillRect(750, 50+width-fillH, 30, fillH, color1, color2, true);
- };
- Scene_Battle.prototype.createTpBar = function() {
- this.TpBar = new Battle_Tp_Bar(0, 0, 816, 624);
- this.addChild(this.TpBar);
- };
- var battleWindows = Scene_Battle.prototype.createAllWindows;
- Scene_Battle.prototype.createAllWindows = function() {
- battleWindows.call(this)
- this.createTpBar();
- };
- })();
Advertisement
Add Comment
Please, Sign In to add comment