Ejemplo n.º 1
0
Archivo: Form1.cs Proyecto: jonstad/MOO
 public Form1()
 {
     InitializeComponent();
     MooRandom.Init();
     a = new Bitmap(pictureBox1.Size.Width, pictureBox1.Size.Height);
     Galaxy.Init();
     Galaxy.Update();
     shipViewControl1.UpdateList();
     DrawGalaxy();
 }
Ejemplo n.º 2
0
Archivo: Ship.cs Proyecto: jonstad/MOO
        public void Update()
        {
            Location dest = Galaxy.stars[Destination.IDHomeStar].Location;

            CurrentLocation.X = (dest.X >= CurrentLocation.X) ? CurrentLocation.X + Speed: CurrentLocation.X - Speed;
            CurrentLocation.Y = (dest.Y >= CurrentLocation.Y) ? CurrentLocation.Y + Speed : CurrentLocation.Y - Speed;

            //  if (CurrentLocation.X==dest.X && CurrentLocation.Y == dest.Y)
            if (Math.Abs(CurrentLocation.X - dest.X) < 2 && Math.Abs(CurrentLocation.Y - dest.Y) < 2)
            {
                Random r               = new Random(Environment.TickCount);
                int    rnd             = MooRandom.GetRnd(0, Galaxy.stars.Count);
                Star   destinationstar = Galaxy.stars[rnd];
                Destination            = destinationstar.Planets[0];
                Destination.IDHomeStar = destinationstar.ID;
            }
        }