I'm using MogHunters "MOG_SceneMenu.js (it's part of his "Monogatari" plugin set, each handling their own scene). It's a cool plugin but I'm having some problems...
Basically, I want to display the actor's current level number center aligned, inside an orb, so that even when the number becomes 10+, it will still be centered within that orb and not look like it does in the image below.
As you can see, the numbers "4" and "7" looks fine but "13" and "10" is off-center because they consist of two numbers. I assume this happens because the actor's current level number is either aligned to the left or to the right.
I looked at the code myself but as per usual, I'm such a clueless bamboo bear. Can't really say I understand much. But I think this here is the code that relates to how the numbers for the actor's current level are drawn:
This might be obvious for someone who knows javascript from reading the above snippet, but I'll mentioned it anyway. These numbers that are used to display the actors current level are not drawn with the gamefont. They're drawn from an image file you have to make yourself.
The one I'm using for my game is this one below:
-----------------------------------------------------
[EDIT; I've already found a solution to the below problem so the only thing I need help with is the above issue. (Thank you @minnty200) ]
And then there's one more problem, which is not as crucial, it's one that I can live with but eh... might as well ask and learn something.
In Moghunter's menu plugins the HP and MP gauges are animated. Or rather, they scroll horizontally in a looping manner. This looks pretty cool and I've decided to make use of this but... it scrolls waaay too fast. Just look at the image below and I think you see what I mean:
At least in my opinion it moves so fast I find it almost stresses me out, and I think it actually distracts the player more than it should. Therefore I'd like to slow down the movement of the HP an MP bar somehow, but as usual, there's no parameter for it so it would have to be done directly in the script - something that's a bit beyond my own knowledge.
So, uh... help... anyone? 😢
I'm pretty clueless but again, I assume (don't trust me on this) that the relevant piece of code is inside this snippet below?
Many thanks to anyone taking their time to read through all this.
[EDIT; Moghunters Monogatari plugins can be downloaded from here: https://atelierrgss.wordpress.com/rmv-monogatari/]
Basically, I want to display the actor's current level number center aligned, inside an orb, so that even when the number becomes 10+, it will still be centered within that orb and not look like it does in the image below.
As you can see, the numbers "4" and "7" looks fine but "13" and "10" is off-center because they consist of two numbers. I assume this happens because the actor's current level number is either aligned to the left or to the right.
I looked at the code myself but as per usual, I'm such a clueless bamboo bear. Can't really say I understand much. But I think this here is the code that relates to how the numbers for the actor's current level are drawn:
Code:
//==============================
// * create LV Number
//==============================
MCharStatus.prototype.createLVNumber = function() {
this._lv_number = [];
this._NumberData3 = [this._numberImg3.width / 10,this._numberImg3.height]
var x = this._layout.x + Moghunter.scMenu_LVNumberX;
var y = this._layout.y + Moghunter.scMenu_LVNumberY;
for (var i = 0; i < 3; i++) {
this._lv_number[i] = new Sprite(this._numberImg3);
this._lv_number[i].visible = false;
this._lv_number[i].opacity = 255;
this._lv_number[i].x = x ;
this._lv_number[i].y = y ;
this.addChild(this._lv_number[i]);
};
this.refresh_number(this._lv_number,this._actor.level,this._NumberData3,x)
};
//==============================
// * Refresh Number
//==============================
MCharStatus.prototype.refresh_number = function(sprites,value,img_data,x) {
if (value > 99999) {value = 99999};
numbers = Math.abs(value).toString().split("");
for (var i = 0; i < sprites.length ; i++) {
sprites[i].visible = false;
if (i < numbers.length) {
var n = Number(numbers[i]);
sprites[i].setFrame(n * img_data[0], 0, img_data[0], img_data[1]);
var nx = -(img_data[0] * i) + (img_data[0] * numbers.length);
sprites[i].x = x - nx;
sprites[i].visible = true;
} else {
var n = 0;
sprites[i].setFrame(n * img_data[0], 0, img_data[0], img_data[1]);
var nx = -(img_data[0] * i) + (img_data[0] * (sprites.length + numbers.length));
sprites[i].x = x - nx;
};
};
};
This might be obvious for someone who knows javascript from reading the above snippet, but I'll mentioned it anyway. These numbers that are used to display the actors current level are not drawn with the gamefont. They're drawn from an image file you have to make yourself.
The one I'm using for my game is this one below:
-----------------------------------------------------
[EDIT; I've already found a solution to the below problem so the only thing I need help with is the above issue. (Thank you @minnty200) ]
In Moghunter's menu plugins the HP and MP gauges are animated. Or rather, they scroll horizontally in a looping manner. This looks pretty cool and I've decided to make use of this but... it scrolls waaay too fast. Just look at the image below and I think you see what I mean:
At least in my opinion it moves so fast I find it almost stresses me out, and I think it actually distracts the player more than it should. Therefore I'd like to slow down the movement of the HP an MP bar somehow, but as usual, there's no parameter for it so it would have to be done directly in the script - something that's a bit beyond my own knowledge.
So, uh... help... anyone? 😢
I'm pretty clueless but again, I assume (don't trust me on this) that the relevant piece of code is inside this snippet below?
Code:
//==============================
// * create LV Number
//==============================
MCharStatus.prototype.createLVNumber = function() {
this._lv_number = [];
this._NumberData3 = [this._numberImg3.width / 10,this._numberImg3.height]
var x = this._layout.x + Moghunter.scMenu_LVNumberX;
var y = this._layout.y + Moghunter.scMenu_LVNumberY;
for (var i = 0; i < 3; i++) {
this._lv_number[i] = new Sprite(this._numberImg3);
this._lv_number[i].visible = false;
this._lv_number[i].opacity = 255;
this._lv_number[i].x = x ;
this._lv_number[i].y = y ;
this.addChild(this._lv_number[i]);
};
this.refresh_number(this._lv_number,this._actor.level,this._NumberData3,x)
};
//==============================
// * Refresh Number
//==============================
MCharStatus.prototype.refresh_number = function(sprites,value,img_data,x) {
if (value > 99999) {value = 99999};
numbers = Math.abs(value).toString().split("");
for (var i = 0; i < sprites.length ; i++) {
sprites[i].visible = false;
if (i < numbers.length) {
var n = Number(numbers[i]);
sprites[i].setFrame(n * img_data[0], 0, img_data[0], img_data[1]);
var nx = -(img_data[0] * i) + (img_data[0] * numbers.length);
sprites[i].x = x - nx;
sprites[i].visible = true;
} else {
var n = 0;
sprites[i].setFrame(n * img_data[0], 0, img_data[0], img_data[1]);
var nx = -(img_data[0] * i) + (img_data[0] * (sprites.length + numbers.length));
sprites[i].x = x - nx;
};
};
};
Many thanks to anyone taking their time to read through all this.
[EDIT; Moghunters Monogatari plugins can be downloaded from here: https://atelierrgss.wordpress.com/rmv-monogatari/]
