Beispiel #1
0
        public Game(GamePlay page)
        {
            random = new Random();
            score = 0;
            int minradius=70;
            int maxradius=150;
            this.page = page;
            w = new World(page, this);
            w.setSpaceship(new Spaceship());
            <<<<<<< HEAD
            int ei = random.Next(0, 6);
            for (int i = 0; i < 7; i++)
            =======
            <<<<<<< HEAD
            int ei = random.Next(0, 8);
            for (int i = 0; i < 9; i++)
            >>>>>>> 7395723aea8da5fff561b8e20616c6f37c826d7a
                if (ei != i) w.addPlanet(new Planet(random,minradius,maxradius, i));
                else w.addPlanet(new Planet(random,2*minradius,maxradius,i, true));
            =======

            for (int i = 0; i < 10; i++) w.addPlanet(new Planet(random,minradius,maxradius, i));
            w.addPlanet(new Planet(random,2*minradius,maxradius,random.Next(0, 9), true));
            >>>>>>> f629e5c28095f54b24d8872f88c38663475e65dc
        }
Beispiel #2
0
        public static void drawWorld(GamePlay page, World w)
        {
            List<Planet> planets = w.getPlanets();
            for (int i = 0; i < planets.Count; i++)
            {
                if (planets[i].image != null) page.ContentPanel1.Children.Add(planets[i].image);
                else page.ContentPanel1.Children.Add(planets[i].ellipse);

            }
            page.ContentPanel1.Children.Add(w.getSpaceship().image);
        }
Beispiel #3
0
 public static void update(GamePlay page, World w)
 {
     Spaceship ship = w.getSpaceship();
     ship.image.RenderTransform = new RotateTransform() { CenterX = ship.image.ActualWidth / 2, CenterY = ship.image.ActualHeight / 2, Angle = 180 * (Math.Atan2(ship.velocity.x, -ship.velocity.y)) / Math.PI };
     Ellipse ellipse = new Ellipse();
     ellipse.Width = 10;
     ellipse.Height = 10;
     ellipse.Margin = new Thickness(ship.getPosition().x, ship.getPosition().y, 0, 0);
     ellipse.StrokeThickness = 10.0;
     ellipse.Stroke = new SolidColorBrush(Colors.OrangeRed);
     page.ContentPanel1.Children.Add(ellipse);
     Vector mult = ship.velocity.times((float)ship.image.ActualHeight / (ship.velocity.getMagnitude()));
     ship.image.Margin = new Thickness(ship.getPosition().x + mult.x, ship.getPosition().y + mult.y, 0, 0);
 }
Beispiel #4
0
 public Game(GamePlay page)
 {
     random = new Random();
     score = 0;
     int minradius=70;
     int maxradius=150;
     this.page = page;
     w = new World(page, this);
     w.setSpaceship(new Spaceship());
     int ei = random.Next(0, 6);
     for (int i = 0; i < 7; i++)
         if (ei != i) w.addPlanet(new Planet(random,minradius,maxradius, i));
         else w.addPlanet(new Planet(random,2*minradius,maxradius,i, true));
 }
Beispiel #5
0
        public static void drawWorld(GamePlay page, World w)
        {
            List<Planet> planets = w.getPlanets();
            <<<<<<< HEAD
            for (int i = 0; i < planets.Count; i++)
            {
                if (planets[i].image != null) page.ContentPanel1.Children.Add(planets[i].image);
                else page.ContentPanel1.Children.Add(planets[i].ellipse);

            }
            =======
            <<<<<<< HEAD
            for (int i = 0; i < planets.Count; i++)
                if (planets[i].image != null) page.ContentPanel1.Children.Add(planets[i].image);
                else page.ContentPanel1.Children.Add(planets[i].ellipse);
            =======
            for (int i = 0; i < planets.Count; i++) page.ContentPanel1.Children.Add(planets[i].ellipse);
            >>>>>>> f629e5c28095f54b24d8872f88c38663475e65dc
            >>>>>>> 7395723aea8da5fff561b8e20616c6f37c826d7a
            page.ContentPanel1.Children.Add(w.getSpaceship().image);
        }