Does anyone know how to remove the text from the sprite while not removing the sprite image itself
here's the code
this is a function from moghunter i was trying to tweak it so it can work with yanfly buff and state core however what happens is that it keeps on stacking the text after it has been created.
i tried "this._stateIcons.bitmap.clear" however it also erases te sprite itself if someone can help me plsssss 😢
here's the code
Code:
Battle_Hud.prototype.refresh_states2 = function() {
this._state_icon.visible = false;
this._battler.need_refresh_bhud_states = false;
for (i = 0; i < this._stateIcons.length; i++){
this._state_icon.removeChild(this._stateIcons[i]);
};
for (i = 0; i < this._stateText.length; i++){
this._state_icon.removeChild(this._stateText[i]);
};
if (this._battler.allIcons().length == 0) {return};
this._state_icon.visible = true;
this._stateIcons = [];
this._stateText = [];
var w = Window_Base._iconWidth;
var icons = this._battler.allIcons().slice(0,w);
var state = this._battler.states().slice(0,w);
var m = Math.min(Math.max(this._battler.allIcons().length,0),Moghunter.bhud_statesMax);
var align = Moghunter.bhud_statesAlign;
for (i = 0; i < m; i++){
this._stateIcons[i] = new Sprite(this._state_img);
this._stateText[i] = new Sprite(this._state_img);
var sx = icons[i] % 16 * w;
var sy = Math.floor(icons[i] / 16) * w;
this._stateIcons[i].setFrame(sx, sy, w, w);
this._stateText[i].setFrame(sx, sy, w, w);
//this._stateText[i].bitmap.clear();
if (align === 1) {
this._stateIcons[i].x = -((w + 4) * i);
} else if (align === 2) {
this._stateIcons[i].y = (w + 4) * i;
} else if (align === 3) {
this._stateIcons[i].y = -((w + 4) * i);
} else {
this._stateIcons[i].x = (w + 4) * i;
};
console.log(this._stateText[i].x);
var turns = this._battler.stateTurns(state[i].id);
turns = Yanfly.Util.toGroup(Math.ceil(turns));
this._stateIcons[i].bitmap.fontSize = 16;
this._stateIcons[i].bitmap.drawText(turns, sx, sy, w, w, 'center');
this._state_icon.addChild(this._stateIcons[i]);
};
};
this is a function from moghunter i was trying to tweak it so it can work with yanfly buff and state core however what happens is that it keeps on stacking the text after it has been created.
i tried "this._stateIcons.bitmap.clear" however it also erases te sprite itself if someone can help me plsssss 😢