Exemplo n.º 1
0
        static public void Load()
        {
            objs = new BaseObject[61];


            for (int i = 0; i < 2; i++)
            {
                objs[i] = new Asteroids(new Point(60 * point.Next(5, 10), i * 20), new Point(-3, 0), new Size(2, 2));
            }

            for (int i = 1; i < objs.Length / 2; i++)
            {
                objs[i] = new Star(new Point(point.Next(0, 200) * point.Next(0, 7), i * 20), new Point(-7, 0), new Size(5, 5));
            }

            for (int i = 30; i < objs.Length; i++)
            {
                objs[i] = new Star(new Point(point.Next(0, 200) * point.Next(0, 7), (i - 30) * 20), new Point(0, +7), new Size(5, 5));
            }

            Timer timer = new Timer();

            timer.Interval = 100;
            timer.Tick    += Timer_Tick;
            timer.Start();
        }
Exemplo n.º 2
0
Arquivo: Stars.cs Projeto: GSedi/NewPT
 public bool Checker2(Asteroids a, int i, int j)
 {
     if ((star.X + i == a.x && star.Y + j == a.y) ||
         (a.x + i == star.X && a.y + j == star.Y))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
 public bool Checker2(Asteroids a, int i, int j)
 {
     if ((asters.X + i == a.asters.X && asters.Y + j == a.asters.Y) ||
         (a.asters.X + i == asters.X && a.asters.Y + j == asters.Y))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 4
0
        //Stars[] t = new Stars[7];
        //Asteroids[] a = new Asteroids[3];


        public Form1()
        {
            InitializeComponent();

            g = this.CreateGraphics();

            black  = new SolidBrush(Color.Black);
            yellow = new SolidBrush(Color.Yellow);
            red    = new SolidBrush(Color.Red);
            white  = new SolidBrush(Color.White);
            green  = new SolidBrush(Color.Green);


            timer1.Enabled  = true;
            timer1.Interval = 100;

            stars  = new List <Stars>();
            asters = new List <Asteroids>();
            buls   = new List <Bullet>();

            //star = new Stars(g, new Point(50, 110));
            //star = new Stars(g, new Point(400, 60));

            Stars s1 = new Stars(g, new Point(50, 110));
            Stars s2 = new Stars(g, new Point(400, 60));
            Stars s3 = new Stars(g, new Point(650, 100));
            Stars s4 = new Stars(g, new Point(880, 275));
            Stars s5 = new Stars(g, new Point(770, 400));
            Stars s6 = new Stars(g, new Point(865, 570));
            Stars s7 = new Stars(g, new Point(380, 500));
            Stars s8 = new Stars(g, new Point(70, 510));

            stars.Add(s1);
            stars.Add(s2);
            stars.Add(s3);
            stars.Add(s4);
            stars.Add(s5);
            stars.Add(s6);
            stars.Add(s7);
            stars.Add(s8);

            Asteroids a1 = new Asteroids(g, new Point(150, 170));
            Asteroids a2 = new Asteroids(g, new Point(190, 420));
            Asteroids a3 = new Asteroids(g, new Point(770, 140));
            Asteroids a4 = new Asteroids(g, new Point(580, 480));

            //Asteroids a5 = new Asteroids(g, new Point(510, 210));
            //Asteroids a6 = new Asteroids(g, new Point(215, 310));
            //Asteroids a7 = new Asteroids(g, new Point(325, 10));

            asters.Add(a1);
            asters.Add(a2);
            asters.Add(a3);
            asters.Add(a4);
            //asters.Add(a5);
            //asters.Add(a6);
            //asters.Add(a7);

            ship = new Spaceship(g, new Point(492, 280));
            gun  = new Gun(g, new Point(492, 280));
            //bullet = new Bullet(g, new Point(492, 255));

            //aster = new Asteroids(g, new Point(180, 200));

            /*for(int i =0; i < 3; i++)
             * {
             *
             *  Point p = new Point(new Random().Next(150, 200));
             *  a[i] = new Asteroids(g, p/*new Point(new Random().Next(1, Width)));
             *  asters.Add(a[i]);
             * }
             */
        }