Or if you’re just trying to make a modal popup window you could throw a semi-transparent rectangle over all your other images and then put your popup on top of it. If your question is more specific, or you include in image, you’re probably going to get a response that better meets your needs.
Thanks for replying.
I want it more like this:
Here congratulations! is popup while the images in background is translucent.
How to create a semi-transparent rectangle?
You can create a rectangle using the standard GameObject factory method “add” available on your current scene. An example would look something like this:
// in scene's create() method
create() {
...
// Get the size of your game canvas
const posX = 0, posY = 0;
const { width, height } = this.sys.game.scale.gameSize;
const color = 0x000000;
const alpha = 0.5;
const darkScreen = this.add.rectangle(posX, posY, width, height, color, alpha)
darkScreen.setOrigin(0, 0);
}
make sure you add this to your scene AFTER your game’s UI, and BEFORE the Congratulations text, or make use of the .setDepth method to manage in what order game elements are displayed from furthest to closest. Here are references to the Phaser 3 Rectangle game object and a relevant example. https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.Rectangle.html