   How do I mirror sprite frames?
  I have a sprite sheet of a character walking to the right, and I have that working fine. Now I need to make the character walk to the left. I can do that by duplicating the sprite sheet graphic, mirroring all the sprite tiles and switching the sprite sheet (or set of frames in a sheet) depending on which way the character is walking.My problem is I do not want to duplicate all the sprite sheets and mirror them with a graphics editor program. I was hoping there was a way to just mirror the frame in code. Here is the code I am using to load and display the sprites:LPD3DXSPRITE sprite;LPDIRECT3DTEXTURE9 image;void Sprite::LoadSprite(){    //create sprite handler object    D3DXCreateSprite(d3ddev, &sprite);    //load texture with "pink" as the transparent color    image = LoadTexture("graphics/spritesheet.bmp", D3DCOLOR_XRGB(255,0,255));    //initialize the sprite's properties    x = 20;    y = 20;    width = 50;    height = 64;    curframe = 1;    lastframe = 7;}void Sprite::DisplaySprite(TileMap* map){    //start sprite handler    sprite-&gt;Begin(D3DXSPRITE_ALPHABLEND);    //create vector to update sprite position    D3DXVECTOR3 position( (float)x, (float)y, 0 );    //configure the rect for the source tile    RECT srcRect;    int columns = 8;    srcRect.left = (curframe % columns) * width;    srcRect.top = (curframe / columns) * height;    srcRect.right = srcRect.left + width;    srcRect.bottom = srcRect.top + height;    //draw the sprite    sprite-&gt;Draw(   image,    &srcRect,   NULL,   &position,   D3DCOLOR_XRGB(255,255,255));   //stop drawing    sprite-&gt;End();}Any help on doing this would be great!   
  How about swapping the left and right, so top left points to the top right, and top right points to the top left.;  That does not seem to work. Say I have the rect defined to the first frame in the sprite sheet:srcRect.left = 0;srcRect.top = 0;srcRect.right = 50;srcRect.bottom = 64;I thought doing the following would display the mirror of the first frame, but it does not:srcRect.left = 50;srcRect.top = 0;srcRect.right = 0;srcRect.bottom = 64;;  After a lot of time searching it turns out that what you suggested should work according to the Direct3D documentation. It turns out this must be an error in the documentation or a bug as it doesn’t actually work (as I described with the above post).I did however find a solution that works out quite well, and that is scaling the X coordinate by a negative value. Updated code:LPD3DXSPRITE sprite;LPDIRECT3DTEXTURE9 image;void Sprite::LoadSprite(){//create sprite handler objectD3DXCreateSprite(d3ddev, &sprite);//load texture with "pink" as the transparent colorimage = LoadTexture("graphics/spritesheet.bmp", D3DCOLOR_XRGB(255,0,255));//initialize the sprite's properties   x = 20;    y = 20;    width = 50;    height = 64;    curframe = 1;    lastframe = 7;    movex = 5;    movey = 0;}void Sprite::DisplaySprite(TileMap* map){//start sprite handler    sprite->Begin(D3DXSPRITE_ALPHABLEND);    //configure the rect for the source tile    RECT srcRect;    int columns = 8;    srcRect.left = (curframe % columns) * width;    srcRect.top = (curframe / columns) * height;    srcRect.right = srcRect.left + width;    srcRect.bottom = srcRect.top + height;// transformationD3DXVECTOR2 position( (float)x, (float)y );D3DXVECTOR2 spriteCentre=D3DXVECTOR2(0.0f,0.0f);float rotation=0.0f;//scalingD3DXVECTOR2 scaling(-1.0f,1.0f);// Build our matrix to rotate, scale and position our spriteD3DXMATRIX mat;// out, scaling centre, scaling rotation, scaling, rotation centre, rotation, translationD3DXMatrixTransformation2D(&mat, NULL, 0.0,&scaling,&spriteCentre,rotation,&position);// Tell the sprite about the matrixsprite->SetTransform(&mat);// Draw the spritesprite->Draw(image,&srcRect,NULL,NULL,D3DCOLOR_XRGB(255,255,255));   //stop drawing    sprite->End();}Let me know if there is any reason why I should not do it like this, otherwise I can mark this as solved.   ;  That looks good. I came looking for this thread this morning to suggest the SetTransform method, but looks like you found it yourself.