Update game config

Hello,

Is it possible to update game config during runtime, like game.transparent = true becuase when i tried it, it’s not working

No, the renderer has already been created by then.

2 Likes

Both the 2D and WebGL contexts of the canvas element require a set of contextAttributes upon creation. These attributes can’t be changed once the context is created since the canvas relies on them to make some assumptions while drawing. In your case, if alpha (transparency) is disabled on creation, the canvas can speed up drawing of transparent images since it knows it will be drawing them to an opaque background.

If you need a transparent background at any point, you’ll have to set that in the game config upon creation. You can always just paint a big ol’ background rect before adding all your game objects each frame when you want a solid background!

1 Like

Thanks a lot!