So a few days ago, I was programming a HUD with image gauges in javascript (no plugins) to have more freedom and learn some java in the process. All was going well, making sure the masks worked, and they did! Until I encountered a problem, the guages weren't filling back up. I found the solution to that which was that it was continuously creating new masks instead of moving the existing ones. So I made sure they didn't do that. Problem solved right? Wrong, now the masks only update for one actor at a time.
I created a loop to make sure there is a mask for each gauge.
But when I try to move the mask per actor, it seems to move all of them to the position of the actor being targeted?
So I guess my question is, how do I make sure each mask updates independently from each other? Since I'm still pretty new at java I'm not sure how to do that myself.
I created a loop to make sure there is a mask for each gauge.
//Where the masks are createdWindow_BattleStatus.prototype.createGaugeContents = function() { this._gaugeContents = new Sprite(); var ww = this.contentsWidth(); var wy = this.contentsHeight(); this._gaugeContents.bitmap = new Bitmap(ww, wy); this.addChildAt(this._gaugeContents, 3); this._gaugeContents.move(this.standardPadding(), this.standardPadding()); for (var i = 0; i < $gameParty.battleMembers().length; ++i) { var actor = $gameParty.battleMembers()[i]; this._hpGauge = new Sprite(); this._hpGauge._label = actor.name(); this._hpMask = new PIXI.Graphics().beginFill(0xFFFFFF).drawRect(0, 0, 95, 89); this._hpGauge.mask = this._hpMask; this._hpGauge.addChild(this._hpMask); this._hpMask._label = actor.name(); this.addChildAt(this._hpGauge, 4); this._mpGauge = new Sprite(); this._mpGauge._label = actor.name(); this._mpMask = new PIXI.Graphics().beginFill(0xFFFFFF).drawRect(0, 0, 184, 56); this._mpGauge.mask = this._mpMask; this._mpGauge.addChild(this._mpMask); this._mpMask._label = actor.name(); this.addChildAt(this._mpGauge, 4); };};But when I try to move the mask per actor, it seems to move all of them to the position of the actor being targeted?
//Where the mask is updatedWindow_BattleStatus.prototype.drawItem = function(index) { var actor = $gameParty.battleMembers()[index]; for (var i = 0; i < $gameParty.battleMembers().length; ++i) { if (this._hpMask._label === actor.name()){ var drainH = (68 * actor.hpRate()) + 9; this._hpMask.y = -drainH; } } this.drawBasicArea(this.basicAreaRect(index), actor); this.drawGaugeArea(this.gaugeAreaRect(index), actor); this.drawStateArea(this.basicAreaRect(index), actor);};So I guess my question is, how do I make sure each mask updates independently from each other? Since I'm still pretty new at java I'm not sure how to do that myself.