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 Graphics Flickering on Update

I have a simple piece of code (below) which will run when a stat changes. It displays a bar and using the width I've been able to make it equal the health bar. Non of this is below because other functions interact with it however the point is that I'd like this bar to be updated alot. Everytime it updates even once it flickers. The contents disappear and reappear in the new state for a frame. I'd like that to stop because the health is going to slowly regen and I don't want constant flicker.

JavaScript:
if(stage == 0){ //If it's a new window
        index = TrinityCustomWindows.length; //Make the index the end. Array's start at 0 so the length will be the next index.
        TrinityCustomWindows.push(customWindow); //Add the window to the end of our array. Used to antiflicker
        TrinityCustomWindows[index] = SceneManager._scene.addChildAt(TrinityCustomWindows[index],index); //Add the child at the index
        TrinityCustomWindows[index].contentsOpacity = opacity; //Set the opacity
        TrinityCustomWindows[index].opacity = 0; //Set the opacity
        return index; //Stop running this, if you were to test the output greater than 3 is the one you want
    } else if(stage == 1){ //If changing a window no flicker
        //TrinityCustomWindows[index] = customWindow; //Overide the array storage with the window
        TrinityCustomWindows[index].contents = contents_; //Override the current child with the contents
        TrinityCustomWindows[index].contentsOpacity = opacity;//Set the opacity
        TrinityCustomWindows[index].width = width;//Set the width
        TrinityCustomWindows[index].height = height;//Set the height
        TrinityCustomWindows[index].x = x;//Set the x
        TrinityCustomWindows[index].y = y;//Set the y
        return index;//Stop running this, if you were to test the output greater than 3 is the one you want
}
I think I'm doing something simple completely wrong here. So if so please help!

Minor Update: Preloading might be very slightly faster and be a little bit more however I can't tell and it's still too much to reasonable do this.

Update 2: Contents seems to be the issue. Whenever I change the contents it flashs. Just changing the width and height etc doesn't make it flash. In theory I could work with this making sure there is a layer above that is set when altering the value and then disappears before the end of it however it's not a very elegant solution.

Update 3: Happen to help out someone on the forums and figured out where pictures are stored and how to raise the limit of pictures. Tried using my picture switcher code, would be a lot of work making a bunch of images however...still flicker with pictures! My only hope is to make an event that turns on, changes a picture that I've planted in there from an event which is technically possible however lot more code.
https://rpgmakermv.co/threads/is-there-a-plugin-that-allows-sub-folders-in-the-pictures-directory.3192/
That was the switcher I tried.

Update 4: Using X and Y to get around this wont work... 240 images x 6, 74 x 6 slowed the game down. I have a 980ti, i7 and 16gb of ram... if it slows this down I'm doing something wrong lol.

Update 5: I think I'm going to abandon Scene Manger for now and use pictures and just insert straight into the array. Provided I use a preload script they don't flicker. Does mean making a load more images however at least it works.
 
Last edited:
Top