Camera pan

42 views
Skip to first unread message

JLMG

unread,
Jul 31, 2015, 4:56:12 PM7/31/15
to haxef...@googlegroups.com
Hello I'm new to haxeflixe and I'm trying to make the tween a camera pan 50 pixels in front the player or to x position, I tried to use FlxG.camera.setPosition and it works but my viewport is also moving, changing FlxG.camera.scroll.x doesn't affect the camera. Is there a way to do this? Should I make an invisible sprite always in front of the player and make the camera follow it? It seems "hacky".

Thanks in advance

Seb Jones

unread,
Aug 1, 2015, 2:09:22 PM8/1/15
to HaxeFlixel
The camera's followLead property might be what you are looking for. e.g.

FlxG.camera.followLead.x = 50;

J-L MG

unread,
Aug 1, 2015, 3:39:21 PM8/1/15
to HaxeFlixel
For anyone wondering you need to disable the camera following to make use of camera.scroll

this made it work for me:

 FlxG.camera.follow(null, FlxCamera.STYLE_PLATFORMER);
Reply all
Reply to author
Forward
0 new messages