Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Window_update which bitmap is it on?

Derek Chow

Villager
Xy$
0.00
So on an update function how do I know which variable bar to update? Since I forlooped to create multiple bars. Thanks. The update function will not know which bitmap is which?


Code:
for(var i = 0; i < achievementText.length; i++){
        this.createVariableBars(i);
    }

Window_unlockables.prototype.createVariableBars = function(x){
    this._variableBar = new Sprite();

    this.addChild(this._variableBar);
    this.drawBars(x);
};

Window_unlockables.prototype.drawBars = function(x) {
    var lineheight = this.lineHeight();
    var rate = eval(achievementVar[0])/achievementNumber[0];
    this._variableBar.x = this.x + 20;
    this._variableBar.y = lineheight*(x+2);
    this.drawText(achievementText[0],0,lineheight*x,Graphics.boxWidth/3,'left');
    this._variableBar.bitmap = new Bitmap(this.variableBarWidth(),this.variableBarHeight());
    this._variableBar.bitmap.fillRect(0,0,this.variableBarWidth(),this.variableBarHeight(),"#424242");
    this._variableBar.bitmap.fillRect(0,0,rate,this.variableBarHeight(),"green");
};
 
Top