Example #1
0
 /// <summary>
 /// Построить объект
 /// </summary>
 /// <param name="r"></param>
 /// <returns></returns>
 public override bool Draw(Random r, PointGrath p)
 {
     GL.Color3(Color.Red);
     Print2D((float)Pos.X - bit.Width / 2, (float)Pos.Y + bit.Height / 2);
     //return true;
     return(Update(r));
 }
Example #2
0
 public BaseObject(PointGrath pos, Speed dir, PointGrath size, Screen screen)
 {
     this.screen = screen;
     this.Pos    = pos;
     this.dir    = dir;
     this.size   = size;
 }
Example #3
0
        public Danger(PointGrath pos, Speed dir, PointGrath size, Screen screen)
        {
            this.screen = screen;
            this.pos    = pos;
            this.dir    = dir;
            this.size   = size;

            bit = (Bitmap)Image.FromFile("network.png");
            //bitByte = Elements.;
        }
Example #4
0
 public Background(PointGrath pos, Speed dir, PointGrath size, Screen screen)
 {
     if (pos.X < 0 || pos.X > screen.Width || pos.Y < 0 || pos.Y > screen.Height ||
         size.X < 0 || size.X > screen.Width / 2 || size.Y < 0 || size.Y > screen.Height / 2)
     {
         throw new GameObjectException();
     }
     this.screen = screen;
     this.pos    = pos;
     this.dir    = dir;
     this.size   = size;
 }
Example #5
0
        public Player(PointGrath pos, Speed dir, PointGrath size, Screen screen) : base(pos, dir, size, screen)
        {
            if (pos.X < 0 || pos.X > screen.Width || pos.Y < 0 || pos.Y > screen.Height ||
                size.X < 0 || size.X > screen.Width / 2 || size.Y < 0 || size.Y > screen.Height / 2)
            {
                throw new GameObjectException();
            }

            this.screen = screen;
            this.Pos    = pos;
            this.dir    = dir;
            this.size   = size;
            spaceship   = (Bitmap)Image.FromFile("rocket2.png");
            spaceship2  = (Bitmap)Image.FromFile("rocket.png");
        }
Example #6
0
 public Erath(PointGrath pos, Speed dir, PointGrath size, Screen screen) : base(pos, dir, size, screen)
 {
 }
Example #7
0
 public override bool Draw(Random r, PointGrath p)
 {
     this.r = r;
     Print2D((float)Pos.X, (float)Pos.Y);
     return(Update(r));
 }
Example #8
0
 public Bullet(PointGrath pos, Speed dir, PointGrath size, Screen screen, int power) : base(pos, dir, size, screen)
 {
     Power = power;
 }
Example #9
0
 /// <summary>
 /// Построить объект
 /// </summary>
 /// <param name="r"></param>
 /// <returns></returns>
 public abstract bool Draw(Random r, PointGrath p);
Example #10
0
 public Earth(PointGrath pos, Speed dir, PointGrath size, Screen screen) : base(pos, dir, size, screen)
 {
     bit = (Bitmap)Image.FromFile("Earth.png");
 }
Example #11
0
 public Danger_lvl2(PointGrath pos, Speed dir, PointGrath size, Screen screen) : base(pos, dir, size, screen)
 {
 }
Example #12
0
        public Medicine(PointGrath pos, Speed dir, PointGrath size, Screen screen) : base(pos, dir, size, screen)
        {
            var r = new Random();

            speed = r.Next(200, 300);
        }
Example #13
0
        /// <summary>
        /// Построить объект
        /// </summary>
        /// <param name="r"></param>
        /// <returns></returns>
        public override bool Draw(Random r, PointGrath p)
        {
            Pos = p;
            GL.Color3(Color.Black);
            PrintSpaceShip2D((float)p.X - spaceship2.Width / 2, (float)p.Y + spaceship2.Height / 2,
                             spaceshipByte2, spaceship2);

            GL.Color3(Color.Honeydew);
            PrintSpaceShip2D((float)p.X - spaceship.Width / 2 + 1, (float)p.Y + spaceship.Height / 2 + 4,
                             spaceshipByte, spaceship);

            var l     = r.Next(50, 250);
            var color = r.Next(160, 255);

            GL.LineWidth(1);
            GL.Begin(PrimitiveType.Lines);
            var a = 10;

            GL.Color3((byte)color, (byte)(color / 1.5), (byte)0);
            GL.Vertex2(p.X - 150, (float)p.Y + a);
            GL.Vertex2(p.X - 150 - l, (float)p.Y + a);
            GL.Color3((byte)color / 1.2, (byte)0, (byte)0);
            GL.Vertex2(p.X - 155, (float)p.Y + 10 + a);
            GL.Vertex2(p.X - 155 - l / 1.3, (float)p.Y + 10 + a);
            GL.Vertex2(p.X - 155, (float)p.Y - 10 + a);
            GL.Vertex2(p.X - 155 - l / 1.3, (float)p.Y - 10 + a);
            GL.Vertex2(p.X - 150 - l / 1.2, (float)p.Y + a);
            GL.Vertex2(p.X - 150 - l, (float)p.Y + a);

            GL.Color3((byte)color, (byte)(color / 1.5), (byte)0);
            GL.Vertex2(p.X - 140, (float)p.Y + a - 45);
            GL.Vertex2(p.X - 140 - l / 1.5, (float)p.Y + a - 45);
            GL.Color3((byte)color / 1.2, (byte)0, (byte)0);
            GL.Vertex2(p.X - 145, (float)p.Y + 10 + a - 45);
            GL.Vertex2(p.X - 145 - l / 1.8, (float)p.Y + 10 + a - 45);
            GL.Vertex2(p.X - 145, (float)p.Y - 10 + a - 45);
            GL.Vertex2(p.X - 145 - l / 1.8, (float)p.Y - 10 + a - 45);
            GL.Vertex2(p.X - 140 - l / 1.8, (float)p.Y + a - 45);
            GL.Vertex2(p.X - 140 - l / 1.5, (float)p.Y + a - 45);

            GL.Color3((byte)color, (byte)(color / 1.5), (byte)0);
            GL.Vertex2(p.X - 140, (float)p.Y + a + 50);
            GL.Vertex2(p.X - 140 - l / 1.5, (float)p.Y + a + 50);
            GL.Color3((byte)color / 1.2, (byte)0, (byte)0);
            GL.Vertex2(p.X - 145, (float)p.Y + 10 + a + 50);
            GL.Vertex2(p.X - 145 - l / 1.8, (float)p.Y + 10 + a + 50);
            GL.Vertex2(p.X - 145, (float)p.Y - 10 + a + 50);
            GL.Vertex2(p.X - 145 - l / 1.8, (float)p.Y - 10 + a + 50);
            GL.Vertex2(p.X - 140 - l / 1.8, (float)p.Y + a + 50);
            GL.Vertex2(p.X - 140 - l / 1.5, (float)p.Y + a + 50);
            GL.End();

            GL.Color3(Color.Black);
            GL.Begin(PrimitiveType.TriangleFan);
            GL.Vertex2(p.X + 250, p.Y - 240);
            GL.Vertex2(p.X + 250, p.Y - 300);
            GL.Vertex2(p.X - 250, p.Y - 300);
            GL.Vertex2(p.X - 250, p.Y - 240);
            GL.End();


            if (_energy > 0)
            {
                GL.Begin(PrimitiveType.TriangleFan);
                var c = Color.Green;
                GL.Color3((byte)(255 - (255 * (_energy / 100.0))),
                          (byte)(255 * (_energy / 100.0)), c.B);
                GL.Vertex2(p.X - 240 + (485 * (_energy / 100.0)), p.Y - 245);
                GL.Vertex2(p.X - 240 + (485 * (_energy / 100.0)), p.Y - 295);
                GL.Color3(Color.Red);
                GL.Vertex2(p.X - 240, p.Y - 295);
                GL.Vertex2(p.X - 240, p.Y - 245);
                GL.End();
            }

            GL.Color3(Color.White);
            //TextGame.Print2DText((float)(p.X - 250), (float)(p.Y - 300), $"100/{_energy}");

            return(true);
        }