Jump to content
  • Advertisement
Sign in to follow this  
phil67rpg

space invaders sprites

This topic is 2297 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.

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.

Share this post


Link to post
Share on other sites
Advertisement

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

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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!