Set arcade screen height to variable

please help I want to make the arcade screen height and width to be changeable so I am asking is it possible

5 Likes

Not possible, you cannot change screen size dynamically. You can try to fake with the zoom extension though

4 Likes

It is possible to change the screen size, but not while your program is running. Only once.
This topic outlines how to do it:

It only works in JavaScript, not blocks, so I would make a copy of your project before going into JaveScript and trying this.

1 Like

Technically, you can zoom out of your view point but the screen borders and size are fixed unfortunately.

You can, just go to java script and convert it back into blocks it should look like this:

namespace userconfig {
    export const ARCADE_SCREEN_WIDTH = 160
    export const ARCADE_SCREEN_HEIGHT = 120
}

keep the screen size a 3.2 ratio or it will look strange.
change the numbers however you want.

yeah I did that with digdigio

you are wrong

2 Likes

oh thanks I thought you could change it if you turned into a variable

Sucks you can’t change the aspect ratio. Wide screen makecode games would look awesome.

actually, you can add a small amount of javascript code to change the resolution like this

2 Likes

no I know about this but I want the screen height to not be a constant and instead be a variable

There is no way to change it from a constant. The closest you can get is to use the zoom extension → https://github.com/kiwiphoenix364/pxt-zoom
Alternatively you could use the setttings extension to save all your game’s needed data and reset the simulator with a different resolution. I haven’t tried that ever though and I’m only 75% this second method works…

That is what brohann was answering. It is possible to change the screen resoluttion. But not after the game has started. So you can’t change the resolution mid game. Or make it a variable as you’re saying. But you could try to set the resolution to higher than what you actually need, and then use the zoom extension to to make it look like the right resolution. Then you can zoom out if you need to see more or similar.

yea thats at the start but you cant set it as a variable since that snippet is actually going deeper than usual into the “innerArcade” if thats a thing

yeah brohann knows that he meant u cant change it in the game

what if you replaced const with var or let

yup exactly I tried let and it no work

It is a const in the base arcade code, so unless you edit the base arcade code by forking the arcade repo and making your own, you can’t do that. Basically what you are doing here is overriding the base arcade const with your own, but you cannot replace it with a “let” because… I’ve tried and it doesn’t work.

maybe in beta guys…@richard no?

Who tried forking Arcade.pxt?