Hi!
I’m having a bit of a problem…
In my main Game class i have the following code for scaling the game depending on fullscreen or not
(Resize event)
scaleX = Lib.current.stage.stageWidth / _stageBaseWidth // 800;
scaleY = Lib.current.stage.stageHeight / _stageBaseHeight //480;
Each time a level is completed i run the following function:
private function initNewStage(): Void {
_stage = null;
removeChild(_stage);
_level += 1;
_stage = new Stage(_line, _background, this);
addChild(_stage);
}
Now, if i start the game in window mode it’s fine. But when i switch to fullscreen and a new level is initialized, the sprites inside the stage class disappears - yet their x/y positions remain the same. Shouldn’t the scaling keep them in the same position?
The stage class populates a list of class Dot
class Dot extends Sprite
{
private var distanceFromCenter:Float;
private var angle:Float;
private var angleIncrement:Float;
public function new(_line: Line)
{
super();
var svg = new SVG (Assets.getText ("img/Dot.svg"));
svg.render (graphics);
this.x = _line.x + Math.floor(Math.random() * _line.width);
this.y = Lib.current.stage.stageHeight / 2 - (this.height / 2 - 2);
}
}
It is this Dot class that disappears when i switch between fullscreen & window-mode.
It’s still on the screen but it’s being drawn outside the viewport.
Sorry for the wall of text. I hope it makes sense