Bugged SceneWindowHeight in html5?

I’m making a Flappy Bird clone and to spawn obstacles (pipes, etc.) I’m using following expression for Y component: Random(SceneWindowHeight())

It works fine in native, but in HTML5 it spawns things all over the place making some unwinnable situations.

Maybe, I have just checked actually what value is returned using a text object, and in HTML5 it returns 955 but the height of the scene is 600, at least this is what is set in the properties of the project :confused:
But maybe in HTML5, 955 is the default and only height size, you can only stretch and zoom but you can’t change the actual size of the canvas and so it looks wrong in HTML5 if you expecting the height is something different than 955.

Another stupid suggestion of mine : at the begining of the game, make an invisible sprite objet go from the bottom-left to the top-right of the screen. Make it stop when it collides with another object offscreen (the “border” of the screen) and count the number of pixels on x and y it has covered.
Then, you should have the exact “screen” dimensions.

mtarzaim be careful with this solution as the result could vary according to the framerate. Better simply hardcode the scene height and width, simple and guaranteed to work :slight_smile:

For now in HTML5 games, SceneWindowHeight return the height of the page. So I’m going to change this so that:
SceneWindowHeight returns the height of the scene as expected (independant from the size of the browser window).
ScreenHeight (not available yet in HTML5 games) will returns the height of the “screen” (but as screen size is not available in HTML5, it will be the height of the page, i.e the “screen” area available for the game).

It should be more consistent like this :slight_smile:

Yeah, that’ll be great. I’m making game that is suited for Android so really need it to be taken care of. Thank you.