4
Reply

Moving stars

albert albert

albert albert

Apr 20 2011 4:12 AM
1.7k
Hi,

I just want to move the stars from up to down.

This is my method.

If I put breakpoint on speed I see a number of speed. But the stars doesnt move.

[code]
 public void StarsSpeed(Rectangle boundaries)
  { 
  Point randomPointh;
  Star newStar;

  int randomX = random.Next(boundaries.Left,boundaries.Width);
  int randomY = random.Next(boundaries.Top,boundaries.Height);
  randomPointh = new Point(randomX, randomY);
  int starsSpeed = 10;
  int height = boundaries.Height;
  int starsNumbersSpeed = starList.Count;

  for (int i = 0; i < starList.Count; i++)
  {
  var star = starList.Count;
  //Star star = RandomStar(boundaries);
  speed = (float)random.NextDouble() * 10 + 2;
  //starList.Add(star); 
  if ((randomPointh.Y += (int)speed) > height)
  {
  //Move(Direction.Down); //(float)random.NextDouble() * 10 + 2;
  //Location.Y += GameConstants.speedStar;
  // speed = GameConstants.speedStar; 
  //speed += GameConstants.speedStar;
  Move(Direction.Down);
  int colorIndex = random.Next(ColorsOfStar.Length);
  Pen pen = ColorsOfStar[colorIndex];
  newStar = new Star(randomPointh, pen); 
  //starList.Add(star);
  } 
  }
  }//End method

[/code]

THX

Attachment: star.rar

Answers (4)