space invaders sprites

Started by
1 comment, last by phil67rpg 11 years, 10 months ago
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.

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


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

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

Ehhm...what is your problem ?
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.

This topic is closed to new replies.

Advertisement