flixel-ui
flixel-ui copied to clipboard
Can't get to show RPG Interface demo/popup_demo.xml on center of the screen
Hi Lars and great people from Level Up Labs,
I have a popup based on RPG Interface demo/popup_demo.xml to show up at center of the screen I got a map and If I set camera movement using FlxG.camera.follow popup seems to be stuck at x=0, y=0 and there it is visible I can't get to work popup based on RPG Interface demo/popup_demo.xml (https://github.com/HaxeFlixel/flixel-demos/blob/dev/User%20Interface/RPG%20Interface/assets/xml/popup_demo.xml)
If I set
FlxG.camera.x = 100;
FlxG.camera.y = 100;

I expect it too be in the center of screen
I looked the code of class Popup_Demo extends FlxUIPopup and it seems that it should set scrollfactor to 0
Same thing with RPG Interface demo itself if I set FlxG.camera.x = 100;
Maybe I'm missing something
Sorry, previous example is bad, I mean FlxG.camera.scroll.set(100, 0);

So some elements are ok like HUD with scrollfactor 0, but popup itself get's scrolled.
I got it to work by adding forceScrollFactor(0, 0); to create function
I have never tested this with a game with a camera, so this is likely an oversight! Does putting a "forceScrollFactor(0,0)" to the create function of FlxUIState (or FlxUI) fix the issue? Ideally I'd like a general solution that works with or without cameras.
I don't know about states, but I think popups should be showed in such way for sure. FlxUIPopup has scrollfactor set to 0, but it's just a parent.
I extend this class to get it to work for me:
class ClosableFlxUIPopup extends FlxUIPopup
{
override public function create():Void
{
super.create();
forceScrollFactor(0, 0);
}
}
That makes sense, popus for sure shouldn't scroll by default.
On Mon, Jan 26, 2015 at 2:07 PM, as3boyan [email protected] wrote:
I don't know about states, but I think popups should be showed in such way for sure. FlxUIPopup has scrollfactor set to 0, but it's just a parent.
I extend this class to get it to work for me:
class ClosableFlxUIPopup extends FlxUIPopup { override public function create():Void { super.create(); forceScrollFactor(0, 0); } }
— Reply to this email directly or view it on GitHub https://github.com/HaxeFlixel/flixel-ui/issues/89#issuecomment-71528283.
www.fortressofdoors.com -- Games, Art, Design