Jump to content

  • Log In with Google      Sign In   
  • Create Account

space invaders sprites


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 04 June 2012 - 10:45 PM

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.

Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 7991

Like
0Likes
Like

Posted 04 June 2012 - 11:34 PM

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

Ehhm...what is your problem ?

#3 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 06 June 2012 - 06:27 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS