Embair Posted December 5, 2016 Share Posted December 5, 2016 Hi, Phaser beginner here. Just spent way too much time tracking down why updating sprites position shortly after it was first created didn't do anything. Turns out setting fixedToCamera=true on the sprite causes position changes to be (temporarily?...) ignored. Sandbox example Seems like a bug to me (or in case it isn't it should probably be mentioned in the fixedToCamera documentation). Link to comment Share on other sites More sharing options...
rgk Posted December 5, 2016 Share Posted December 5, 2016 This isn't a bug, when using fixedToCamera you need to set the cameraOffset for example sprite.cameraOffset.x = 100; Link to comment Share on other sites More sharing options...
Embair Posted December 5, 2016 Author Share Posted December 5, 2016 Ah I see, thanks. Still, that makes the current fixedToCamera documentation quite misleading IMHO. Quote A Game Object that is "fixed" to the camera uses its x/y coordinates as offsets from the top left of the camera during rendering. Probably should read something like "A Game Object that is "fixed" is displayed at a specified offset from the top left of the camera during rendering. The offset can be modified through cameraOffset property, which is initialized with the current object coordinates." The fact that the current coordinates are automatically copied into cameraOffset but further changes to them aren't is a rather nasty newbie trap if you ask me. samme 1 Link to comment Share on other sites More sharing options...
rich Posted December 5, 2016 Share Posted December 5, 2016 Provide a documentation PR against Phaser CE and I'll happily merge it in (you only need change the docs in the source code, not the html output, that is done automatically) Link to comment Share on other sites More sharing options...
Embair Posted December 5, 2016 Author Share Posted December 5, 2016 https://github.com/photonstorm/phaser/pull/2904 Weee, I'm helping! samme 1 Link to comment Share on other sites More sharing options...
rich Posted December 5, 2016 Share Posted December 5, 2016 Merged. See... painless Link to comment Share on other sites More sharing options...
Recommended Posts