• Advertisement
Sign in to follow this  

space invaders sprites

This topic is 2052 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

I am working on a space invaders game using dx9 and c++.I am trying to render a row of alien sprites.I need six sprites for each row.
here is the code I am using.
[code]
void render_alienone()
{
D3DXMATRIX Matrix_alien;
D3DXVECTOR2 Translation_alien(k++,50);
if(k==820)
{
k=0;
}
D3DXMatrixTransformation2D(&Matrix_alien, NULL, NULL, NULL, NULL, 0, &Translation_alien);

g_Sprite->Begin(0);
g_Sprite->SetTransform(&Matrix_alien);
RECT rect;
rect.left=0;
rect.right=40;
rect.top=0;
rect.bottom=rect.top+30;
g_Sprite->Draw(g_Texture_alien, &rect, NULL, NULL, 0xFFFFFFFF);
g_Sprite->End();

D3DXMATRIX Matrix_alien2;
D3DXVECTOR2 Translation_alien2(l++,50);
if(l==820)
{
l=0;
}
D3DXMatrixTransformation2D(&Matrix_alien2, NULL, NULL, NULL, NULL, 0, &Translation_alien2);
g_Sprite->Begin(0);
g_Sprite->SetTransform(&Matrix_alien2);
RECT rect2;
rect2.left=0;
rect2.right=30;
rect2.top=0;
rect2.bottom=rect2.top+30;
g_Sprite->Draw(g_Texture_alien2, &rect2, NULL, NULL, 0xFFFFFFFF);
g_Sprite->End();
};
[/code]

I will continue to work on the problem and any help will be greatly appreciated.

Share this post


Link to post
Share on other sites
Advertisement
[quote name='phil67rpg' timestamp='1338871542' post='4946299']
I will continue to work on the problem and any help will be greatly appreciated.
[/quote]
Ehhm...what is your problem ?

Share this post


Link to post
Share on other sites
I am trying to use either vectors or arrays to store the alien sprites,I dont want to render each sprite one at a time but to draw sprites one row of six at a time.

Share this post


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

  • Advertisement