Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Map_Bars.js
- //=============================================================================
- //v1.1 Special Version that goes positive and negative.
- /*:
- * @plugindesc Makes bars yo!
- * @author Jeremy Cannady
- *
- * @param Bar 1 X starting
- * @desc Select x position.
- * @default 0
- *
- * @param Bar 1 Y starting
- * @desc Select the y position.
- * @default 550
- *
- * @param Bar 1 Width
- * @desc Select the width.
- * @default 750
- *
- * @param Bar 1 Height
- * @desc Select the height.
- * @default 20
- *
- * @param Bar 1 color 1
- * @desc Select the color.
- * @default 3
- *
- * @param Bar 1 color 2
- * @desc Select the color.
- * @default 3
- *
- * @param Bar 1 color 3
- * @desc Select the color.
- * @default 10
- *
- * @param Bar 1 color 4
- * @desc Select the color.
- * @default 10
- *
- * @param Bar 1 Text x
- * @desc Select the x.
- * @default 0
- *
- * @param Bar 1 Text y
- * @desc Select the y.
- * @default 0
- *
- * @param Bar 1 Enabled Map
- * @desc On True or false.
- * @default true
- *
- * @param Bar 1 Enabled Battle
- * @desc On True or false.
- * @default true
- *
- * @help Cool bars!
- *
- */
- (function(){
- var parameters = PluginManager.parameters('Map_Bars');
- var bar1EnabledMap = parameters['Bar 1 Enabled Map'];
- var bar1EnabledBattle = parameters['Bar 1 Enabled Battle'];
- var bar1x = parseInt(parameters['Bar 1 X starting']);
- var bar1y = parseInt(parameters['Bar 1 Y starting']);
- var bar1w = parseInt(parameters['Bar 1 Width']);
- var bar1h = parseInt(parameters['Bar 1 Height']);
- var b1c1 = parseInt(parameters['Bar 1 color 1']);
- var b1c2 = parseInt(parameters['Bar 1 color 2']);
- var b1c3 = parseInt(parameters['Bar 1 color 3']);
- var b1c4 = parseInt(parameters['Bar 1 color 4']);
- var b1tx = parseInt(parameters['Bar 1 Text x']);
- var b1ty = parseInt(parameters['Bar 1 Text y']);
- //
- function Map_Bar1() { this.initialize.apply(this, arguments); }
- Map_Bar1.prototype = Object.create(Window_Base.prototype);
- Map_Bar1.prototype.constructor = Map_Bar1;
- Map_Bar1.prototype.initialize = function(x, y, width, height) {
- Window_Base.prototype.initialize.call(this, x, y, width, height);
- this.deactivate();
- this.update();
- };
- Map_Bar1.prototype.update = function() {
- Window_Base.prototype.update.call(this);
- this.contents.clear();
- this.drawBar1(bar1x, bar1y, bar1w);
- };
- Map_Bar1.prototype.drawBar1 = function( x, y, width) {
- var b1maxValue = 100;
- var b1CurrentValue = 0;
- if($gameVariables.value(1)){
- b1CurrentValue = $gameVariables.value(1)
- }else{
- b1CurrentValue = 0;
- };
- var b1rate = b1CurrentValue/b1maxValue;
- //
- this.opacity = 0;
- this.makeFontSmaller();
- var color1 = this.textColor(b1c1);
- var color2 = this.textColor(b1c2);
- var color3 = this.textColor(b1c3);
- var color4 = this.textColor(b1c4);
- if(b1rate>b1maxValue){
- b1rate = 1;
- };
- if(b1rate >= 0){
- this.drawGauge1(x, y, width, b1rate , color1, color2);
- }else{
- rate = -b1rate;
- this.drawGauge1Neg(x, y, width, rate, color3, color4);
- };
- this.drawText('var/varMax', x , y - this.lineHeight(), width, 'center');
- };
- Window_Base.prototype.drawGauge1 = function(x, y, width, rate, color1, color2) {
- var fillW = Math.floor(width * rate / 2);
- this.contents.fillRect(x, y, width, bar1h, this.gaugeBackColor());
- this.contents.gradientFillRect(x+width/2, y, fillW, bar1h, color1, color2);
- };
- Window_Base.prototype.drawGauge1Neg = function(x, y, width, rate, color1, color2) {
- var fillW = Math.floor(width * rate / 2);
- this.contents.fillRect(x, y, width, bar1h, this.gaugeBackColor());
- this.contents.gradientFillRect(x + width/2 -fillW, y, fillW, bar1h, color1, color2);
- };
- Scene_Map.prototype.createBar1 = function() {
- this.Bar1 = new Map_Bar1(0, 0, 816, 624);
- this.addChild(this.Bar1);
- };
- var alias_createDisplayObjects= Scene_Map.prototype.createDisplayObjects;
- Scene_Map.prototype.createDisplayObjects = function() {
- alias_createDisplayObjects.call(this);
- if(bar1EnabledMap == 'true'){
- this.createBar1();
- };
- };
- Scene_Battle.prototype.createBar1 = function() {
- this.Bar1 = new Map_Bar1(0, 0, 816, 624);
- this.addChild(this.Bar1);
- };
- var battleWindows = Scene_Battle.prototype.createAllWindows;
- Scene_Battle.prototype.createAllWindows = function() {
- battleWindows.call(this)
- if(bar1EnabledBattle == 'true'){
- this.createBar1();
- };
- };
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement