Hello! Guys, I need to have a fullscreen at the start of the game. I use Phaser.Scale.ScaleManager and I have this message . Maybe you have an idea to get around it or another way? Thank you.
Hi,
You can’t due to browsers restrictions, you need to make the player press a key or click at the first scene. Perhaps there’s a trick to bypass this restriction…idk.
2 Likes
If you make a installable PWA, you can set "display": "fullscreen"
in your webmanifest.
3 Likes
Hi Alex,
I made a funny ‘ClickScene’ at the start of the game:
export class ClickScene extends Phaser.Scene {
constructor() {
super({
key: "ClickScene",
})
}
preload() {...}
create() {
...
// Enter fullscreen on mobile and breedbeeld
this.clickOverlay.on(
"pointerup",
function () {
this.scale.startFullscreen()
this.scale.setGameSize(RESOLUTION.WIDTH, RESOLUTION.HEIGHT)
// console.log("ClickScreen", "angle:", screen.orientation.angle)
if (window.verticalScreen) {
screen.orientation.lock("landscape") //works in android! but crashes IOS
}
this.scene.stop("ClickScene")
//this.scene.start("MenuScene")
},
this
)
}
}
2 Likes
i think current restrictions due to over-abuse will prohibit that (maybe not in microsoft browsers) you’ll need clickbait to kickstart screen and sound or your own custom version probably - or else one of those annoying poppers where you tell people you have 500 cookies tracking them and if they would please trust you for that so you can actually run your program
1 Like
make your request with setTimeout and set some delay.
1 Like