/*: * @plugindesc Makes a bar on the map that shows a variables progress. * @author Jeremy Cannady * * @param X * @desc X position of the gar. * @default 100 * * @param Y * @desc Y position of the bar. * @default 300 * * @param WIDTH * @desc Width of the bar. * @default 300 * @param HEIGHT * @desc Height of the bar. * @default 50 * * @param CURRENT VALUE * @desc Variable id # of the current value. * @default 1 * * @param MAX VALUE * @desc Variable id of the max value. * @default 2 * * @param FILL COLOR * @desc Fill color of the bar. Default is green. * @default #01DF01 * * @param BACK COLOR * @desc Background color of the bar(unfilled portion). Default is dark gray. * @default #424242 * * @help * Version 1.0 **/var COLD = COLD || {};(function(){ COLD.variableBar = { Parameters : PluginManager.parameters('variableBar'), alias: { Scene_Map:{ createDisplayObjects:Scene_Map.prototype.createDisplayObjects, updateMain:Scene_Map.prototype.updateMain }, }, }; COLD.Param = COLD.Param || {}; COLD.Param.variableBar = COLD.Param.variableBar || {}; COLD.Param.variableBar.x = COLD.variableBar.Parameters['X']; COLD.Param.variableBar.y = COLD.variableBar.Parameters['Y']; COLD.Param.variableBar.width = COLD.variableBar.Parameters['WIDTH']; COLD.Param.variableBar.height = COLD.variableBar.Parameters['HEIGHT']; COLD.Param.variableBar.currentValue = COLD.variableBar.Parameters['CURRENT VALUE']; COLD.Param.variableBar.maxValue = COLD.variableBar.Parameters['MAX VALUE']; COLD.Param.variableBar.fillColor = COLD.variableBar.Parameters['FILL COLOR']; COLD.Param.variableBar.backColor = COLD.variableBar.Parameters['BACK COLOR'];})();(function($){ $.prototype.createDisplayObjects = function() { COLD.variableBar.alias.Scene_Map.createDisplayObjects.call(this) this.createVariableBarSprite(); }; $.prototype.createVariableBarSprite = function() { this._variableBar = new Sprite(); this.addChild(this._variableBar); this._variableBar.bitmap = new Bitmap(Graphics.width, Graphics.height) }; $.prototype.updateMain = function(){ COLD.variableBar.alias.Scene_Map.updateMain.call(this); this.updateVariableBar(); }; $.prototype.updateVariableBar = function(){ var bitmap = this._variableBar.bitmap; var param = COLD.Param.variableBar; var rate = $gameVariables.value(param.currentValue) / $gameVariables.value(param.maxValue); var rate = (rate > 1)? rate = 1 : rate; if(rate){ bitmap.clear(); bitmap.fillRect(param.x, param.y, param.width, param.height, param.backColor); bitmap.fillRect(param.x, param.y, rate * param.width, param.height, param.fillColor); }; };})(Scene_Map);