Help rotating a sprite D3D9

Started by
1 comment, last by littletray26 11 years, 1 month ago

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?

The majority of Internet Explorer users don't understand the concept of a browsing application, or that there are options.
They just see the big blue 'e' and think "Internet". The thought process usually does not get much deeper than that.

Worms are the weirdest and nicest creatures, and will one day prove themselves to the world.

I love the word Clicky
Advertisement
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));
}
My current game project Platform RPG

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 :)

The majority of Internet Explorer users don't understand the concept of a browsing application, or that there are options.
They just see the big blue 'e' and think "Internet". The thought process usually does not get much deeper than that.

Worms are the weirdest and nicest creatures, and will one day prove themselves to the world.

I love the word Clicky

This topic is closed to new replies.

Advertisement