   Sprite center
  hello!I've finished by centering my global coordinate system on the bottom-left corner of the window but I'm still wondering where I should center my sprites. AFAIK, only two choices are preferable :Centered on sprite's center :- pro: Easy rotation- con: All maths require adding half width and half height to x and y componentsCentered on sprite's lower-left corner :- pro: easy to find sprite's left, top, right and bottom bounds (x,y,x+w,y+h)- con: no idea how to manage rotationI'm currently centering my sprites on their center but this makes all math very confusing and sometimes unreadable. As I see it, using bottom-left centered sprite would make unrotated sprite manipulation much more enjoyable but rotated sprite manipulation confusing as hell.-> Which solution is the best?-> Will it be easy to handle rotation with bottom-left centered sprites?-> What do you suggest me to do?   
  - con: All maths require adding half width and half height to x and y componentsYou could always simplify this by adding functions with return values. IE... drawat(CX(),CY());And then have said functions do the math for you. Would clean up syntax, I s'pose and also allow for easy rotation. Just a suggestion, though.-Etyrn   ;  Agreed. Pick one set, and provide member functions (assuming an OOP approach) which calculate and return the other. It honestly is pretty arbitrary, at least until you find there's a bottleneck.Actually, provide member functions to yield either set, so that one pair of functions (or single function, if you have an XY coordinate object) is a plain accessor and the other does some arithmetic. Then you are insulated from external code changes if you decide later to change which values you want to store in the sprite object.However, you should also consider making those functions all private, and in turn called upon by public member functions that *do real work*. Accessors smell.   ;Quote:Original post by TrillianCentered on sprite's lower-left corner :- pro: easy to find sprite's left, top, right and bottom bounds (x,y,x+w,y+h)- con: no idea how to manage rotation...-> Which solution is the best?-> Will it be easy to handle rotation with bottom-left centered sprites?-> What do you suggest me to do?You can just use the bottom-left coordinate version. Rotation can be done by calculating the new coordinates of the 4 vertices like it was a centered sprite standing at (0,0), then add half width and height to the results before adding them to the bottom-left coordinates. This way you can position by the bottom-left of the unrotated sprite but rotate around the center.Viktor   