• Advertisement
Sign in to follow this  

Multiple sprites - multiple transformations

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is the only way for this to have multiple sprite interfaces with one sprite per interface? For example, I have a ship sprite on one interface which I translate and rotate a certain way. If I were to have an enemy on that same interface, that enemy would also be translated and rotated, yes? So I'd need to have them on different interfaces..?

Share this post


Link to post
Share on other sites
Advertisement
you could maybe overlay one sprite onto the other manually (by copying the
individual pixels onto the lower sprite permanantly)after the lowersprite
has been rotated but that would only work for a single rotation and only
if top sprite was completely withing the boundaries of the bottom one.

what are you trying to accomplish and i might be able to suggest an alternative
..although i am far from an expert :)




Share this post


Link to post
Share on other sites
Might not need to. Maybe this works?


a=0;
do {
D3DXMATRIX mat;
D3DXVECTOR2 pos=D3DXVECTOR2(ship[a].x,ship[a].y);
D3DXVECTOR2 mid=D3DXVECTOR2(ship[a].center_x,ship[a].center_y);
D3DXVECTOR2 scale(ship[a].scale,ship[a].scale);
float rot=ship[a].rot;
D3DXMatrixTransformation2(&mat,NULL,0.0,&scale,&mid,rot,&pos);
g_sprite->SetTransform(&mat);
g_sprite->Draw(ship_texture[a],NULL,NULL,NULL,0xFFFFFFFF));
a++;
}while(a<num_ships);



I haven't tested it but if I understand the problem correctly, it seems like this should work.
Best of luck! :)

Share this post


Link to post
Share on other sites
Quote:
Original post by renman29
Might not need to. Maybe this works?

*** Source Snippet Removed ***

I haven't tested it but if I understand the problem correctly, it seems like this should work.
Best of luck! :)


Ah, yes that could work.

And I'm making a sprite-based asteroids game.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement