MV Adjust Bitmaps layer | Bitmap covering choice and message windows

Here's my little script:

var bitmap = new Bitmap(816, 624)
bitmap.fillRect(0, 0, 816, 624, "red")
window.backround = new Sprite(bitmap)
SceneManager._scene.addChild(window.backround)

The problem is that it covers the whole screen including message windows. Of course, I could use pictures instead but wonder whether there's a way to adjust the bitmaps layer.
Hi again! ^^

If you want to put it below the map windows(message, choice, etc), you can find the index of the Window Layer, and add your sprites before it:

JavaScript:
var windowLayer = SceneManager._scene._windowLayer
var index = SceneManager._scene.getChildIndex(SceneManager._scene._windowLayer)
SceneManager._scene.addChildAt(YOUR SPRITE HERE, index)

Although I advise you to make a sprite as a container and insert it before the window layer. Example:

JavaScript:
window.mySpriteContainer = new Sprite()
var windowLayer = SceneManager._scene._windowLayer
var index = SceneManager._scene.getChildIndex(SceneManager._scene._windowLayer)
SceneManager._scene.addChildAt(mySpriteContainer, index)


Now, whenever you want to add something before the window layer, you can do this:

JavaScript:
var bitmap = new Bitmap(816, 624)
bitmap.fillRect(0, 0, 816, 624, "red")
window.backround = new Sprite(bitmap)
// Replaced "SceneManager._scene.addChildAt" with "window.mySpriteContainer"
// Because your sprite container is already inside the Scene, you can add your rectangles directly on the container.
window.mySpriteContainer.addChild(window.backround)
Everything works, thanks 🙂

I ended up using this for background:

Code:
var bitmap = new Bitmap(816, 624)
bitmap.fillRect(0, 0, 816, 624, "red")
window.backround = new Sprite(bitmap)
SceneManager._scene.addChildAt(window.backround, 1)

And this for painting:

Code:
var bitmap = new Bitmap(816, 624);
bitmap.fillRect(self(this)["xMath"], self(this)["yMath"], self(this)["pixel size"], self(this)["pixel size"], self(this)["color"])
var sprite = new Sprite(bitmap);
SceneManager._scene.addChildAt(sprite, 2)

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/adjust-bitmaps-layer-bitmap-covering-choice-and-message-windows.139854/