Hello fellow game makers!
I am looking to edit Moghunter's SceneMenu plugin and add the visual scrolling effect found on the HP and MP bars to my new experience bar (that works other than this little aesthetic thing). Any ideas? Mog's plugins can be found HERE, though you do need to download all of them, then parse out the SceneMenu one I'm using.
I am looking to edit Moghunter's SceneMenu plugin and add the visual scrolling effect found on the HP and MP bars to my new experience bar (that works other than this little aesthetic thing). Any ideas? Mog's plugins can be found HERE, though you do need to download all of them, then parse out the SceneMenu one I'm using.
JavaScript:
//==============================
// * update Exp Meter (starts at line 1543)
//==============================
MCharStatus.prototype.refreshExpMeter = function() {
if (!this._actor) return;
var expValue = this.getExpPercentage();
var percentage = (expValue === "Max") ? 100 : expValue;
this.updateMeter(this._expMeter, this._expMeterData, percentage, 100);
};
//==============================
// * update Meter (starts at line 1553)
//==============================
MCharStatus.prototype.updateMeter = function(sprite,data,v1,v2) {
if (!sprite || !sprite.bitmap) return;
var cw = data[0] * v1 / v2;
if (cw > data[0]) cw = data[0]; // Ensure we don't exceed the width
sprite.setFrame(data[3],0,cw,data[1]);
data[3] += 4;
if (data[3] > data[2]) {data[3] = 0};
};
//==============================
// * create Exp Number (percentage) (starting at line 1639)
//==============================
MCharStatus.prototype.createExpNumber = function() {
this._exp_number = [];
this._NumberData4 = [this._numberImg4.width / 11, this._numberImg4.height];
var x = this._layout.x + Moghunter.scMenu_ExpNumberX;
var y = this._layout.y + Moghunter.scMenu_ExpNumberY;
for (var i = 0; i < 5; i++) {
this._exp_number[i] = new Sprite(this._numberImg4);
this._exp_number[i].visible = false;
this._exp_number[i].opacity = 255;
this._exp_number[i].x = x;
this._exp_number[i].y = y;
this.addChild(this._exp_number[i]);
}
this.refreshExpNumber();
};
MCharStatus.prototype.getExpPercentage = function() {
if (!this._actor) return 0;
if (this._actor.isMaxLevel()) return "MAX";
var currentExp = this._actor.currentExp() - this._actor.currentLevelExp();
var nextLevelExp = this._actor.nextLevelExp() - this._actor.currentLevelExp();
if (nextLevelExp === 0) return "MAX";
return Math.floor((currentExp / nextLevelExp) * 100);
};
MCharStatus.prototype.refreshExpNumber = function() {
if (!this._actor) return;
var expValue = this.getExpPercentage();
Moghunter.refresh_number(this._exp_number, expValue, this._NumberData4, this._layout.x + Moghunter.scMenu_ExpNumberX, true);
};