Updating Bitmaps on windows, Javascript

Discussion in 'Javascript/Plugin Support' started by longarm123, Jul 26, 2016.

  1. longarm123

    longarm123 Warper Member

    Messages:
    4
    Likes Received:
    0
    First Language:
    English
    I used a for loop to create bars bitmaps on a window and it works perfectly fine. Now I want to update them, but I am confused on how the update function differentiate bitmaps from one another?  I'm still a beginner at javascript, but have programmed before. Thanks for the help

    Code:
      Window_Base.prototype.initialize.call(this,x,y,Graphics.boxWidth,Graphics.boxHeight);
        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");
    };
     
    #1

Share This Page