In practice, the viewport seems to follow the selected sprite, but is not quite centered on said sprite. In \lib\quintus_2d.js, it appears that the viewport is centered on the bottom-right corner of the sprite. The following code comes from line 47 of quintus_2d.js:
According to the documentation at http://www.html5quintus.com/guide/sprites.md, the p.x and p.y properties are equal to the center of a sprite object. Adding half the sprite width and height will push the viewport to center on the bottom-right corner.
I see three possibilities:
(1) I am stupid and missing something obvious.
(2) This is intentional behavior and should not be changed. Changing the offsetX and offsetY properties of the viewport can be used as a workaround.
(3) This is a real issue and can be fixed by removing the sprite width and height from the follow calculations.
From the documentation found at http://www.html5quintus.com/guide/2d.md, I gather that the code below should create a viewport that centers on aSprite.
In practice, the viewport seems to follow the selected sprite, but is not quite centered on said sprite. In \lib\quintus_2d.js, it appears that the viewport is centered on the bottom-right corner of the sprite. The following code comes from line 47 of quintus_2d.js:
According to the documentation at http://www.html5quintus.com/guide/sprites.md, the p.x and p.y properties are equal to the center of a sprite object. Adding half the sprite width and height will push the viewport to center on the bottom-right corner.
I see three possibilities: (1) I am stupid and missing something obvious. (2) This is intentional behavior and should not be changed. Changing the offsetX and offsetY properties of the viewport can be used as a workaround. (3) This is a real issue and can be fixed by removing the sprite width and height from the follow calculations.
Any thoughts?