# Help rotating a sprite D3D9

This topic is 1755 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey GameDev

I've 2 sprites, an enemy and a guy, and I'm trying to rotate guy, but not enemy:

void Draw(LPD3DXSPRITE sprite, LPDIRECT3DDEVICE9 d3dDevice)
{
sprite->Draw(texture, &enemy, &D3DXVECTOR3(0, 0, 0), &D3DXVECTOR3(400, 400, 0),                D3DCOLOR_ARGB(255,255,255,255));
sprite->SetTransform(&matrix);
sprite->Draw(texture, &guy, &D3DXVECTOR3(0, 0, 0), &guyPosition, D3DCOLOR_ARGB(255,255,255,255));
}


Problem is it rotates both of them, and I don't know why. Help?

##### Share on other sites
It looks like you need to reset the transformation after each draw call.
void Draw(LPD3DXSPRITE sprite, LPDIRECT3DDEVICE9 d3dDevice)
{
D3DXMATRIX identity;
D3DXMatrixIdentity(&identity);
sprite->SetTransform(&identity);
sprite->Draw(texture, &enemy, &D3DXVECTOR3(0, 0, 0), &D3DXVECTOR3(400, 400, 0),                D3DCOLOR_ARGB(255,255,255,255));
sprite->SetTransform(&matrix);
sprite->Draw(texture, &guy, &D3DXVECTOR3(0, 0, 0), &guyPosition, D3DCOLOR_ARGB(255,255,255,255));
}


##### Share on other sites

Thank you so much. I don't know why I didn't think of this, I just assumed that because I didn't have to do it in 3D transformations, I wouldn't have to for this.

Thank you :)