Jump to content

  • Log In with Google      Sign In   
  • Create Account


Help rotating a sprite D3D9


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 littletray26   Members   -  Reputation: 267

Like
0Likes
Like

Posted 29 March 2013 - 07:16 AM

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

Sponsor:

#2 HappyCoder   Members   -  Reputation: 2249

Like
1Likes
Like

Posted 29 March 2013 - 10:54 AM

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));
}


#3 littletray26   Members   -  Reputation: 267

Like
0Likes
Like

Posted 29 March 2013 - 03:07 PM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS