Search code examples
androidandengine

Confused about Andengine Coordinate system(s)


When I create a sprite at (0,0) and it is centered on the screen and I ask the camera what it's center is (getCenterX and getCenterY) it says (640,400).

I am pretty new with Andengine so there's clearly something basic about coordinates that I am not understanding.


Solution

  • If you're using the default camera, a Sprite placed at 0,0 would be at the top-left corner of the screen. If you've moved the camera, 0,0 could be at the 'centre' of the screen of course.

    Note: Scaling a sprite causes it to shrink towards it's centre (not it's top-left corner) - so a Sprite which is the whole size of the screen will appear in the centre when scaled-down (rather than shrink up into the top-left corner)