Skip to main content
gamedev.net
🔒 Locked

Multiple sprites - multiple transformations

Started by Side Winder 2 replies 850+ views
Original Post
Side Winder
Side Winder
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..?
Wardyahh
Wardyahh
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 :)




--------------------------------------EvilMonkeySoft Blog
renman29
renman29
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,∣,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! :)
Side Winder
Side Winder
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.