Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. Ticks = Ticks + gameTime.ElapsedGameTime.TotalMilliseconds;
  2.  
  3. if (Ticks > 50)
  4. {
  5. for (int Count = 0; Count < 11; Count++)
  6. {
  7.  
  8.  
  9. if (Invaders[Count].GetXPos() < 96)
  10. {
  11. Invaders[Count].setXPos(96);
  12. Invaders[Count].setYPos(150);
  13. }
  14. else if (Invaders[Count].GetXPos() > 924)
  15. {
  16. Invaders[Count].setXPos(924);
  17. Invaders[Count].setYPos(150);
  18. }
  19.  
  20. if (Invaders[Count].GetYPos()%150 == 0)
  21. {
  22. Invaders[Count].MoveHorizontal(2);
  23. alienDirection *= -1;
  24. }
  25. else
  26. {
  27. Invaders[Count].MoveHorizontal(alienSpeed * alienDirection);
  28. }
  29. // Invaders[Count].MoveHorizontal(alienSpeed * alienDirection);
  30. }
  31.  
  32. Ticks = 0;
  33. }
  34.  
  35. using System;
  36. using System.Collections.Generic;
  37. using System.Linq;
  38. using System.Text;
  39. using Microsoft.Xna.Framework;
  40. using Microsoft.Xna.Framework.Audio;
  41. using Microsoft.Xna.Framework.Content;
  42. using Microsoft.Xna.Framework.GamerServices;
  43. using Microsoft.Xna.Framework.Graphics;
  44. using Microsoft.Xna.Framework.Input;
  45. using Microsoft.Xna.Framework.Media;
  46.  
  47. namespace SpaceInvader
  48. {
  49. class Invader
  50. {
  51. Vector2 alienPos;
  52.  
  53. public Invader()
  54. {
  55. alienPos = new Vector2();
  56.  
  57. alienPos.X = 0;
  58. alienPos.Y = 0;
  59. }
  60.  
  61. public void MoveHorizontal(int amount)
  62. {
  63. alienPos.X = alienPos.X + amount;
  64. }
  65.  
  66. public void MoveVertical(int amount)
  67. {
  68. alienPos.Y = alienPos.Y + amount;
  69. }
  70.  
  71. public void setXPos(int pos)
  72. {
  73. alienPos.X = pos;
  74.  
  75. }
  76.  
  77. public int GetXPos()
  78. {
  79. return (int)alienPos.X;
  80. }
  81.  
  82. public void setYPos(int pos)
  83. {
  84. alienPos.Y = pos;
  85. }
  86.  
  87. public int GetYPos()
  88. {
  89. return (int)alienPos.Y;
  90. }
  91.  
  92. public Vector2 GetPos()
  93. {
  94. return alienPos;
  95. }
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement