Ejemplo n.º 1
0
        public Area(PointF pos, Areas type, Image sprite = null, float scaleArea = 1, float scaleSprite = 1.05f)
        {
            this.Pos  = pos;
            this.Type = type;
            Shape     = new SquareShape(scaleArea);
            isDispose = false;

            if (sprite != null)
            {
                Sprite = new ImageSprite(sprite, PointOp.Mul(MainGame.CellSize, scaleSprite));
            }
        }
Ejemplo n.º 2
0
        public void KeyDown(System.Windows.Forms.KeyEventArgs e)
        {
            if (!Inform.idle)
            {
                Inform.Start();
            }

            PointF dir = new PointF();

            if (e.KeyCode == System.Windows.Forms.Keys.Left)
            {
                dir.X = -1;
            }
            if (e.KeyCode == System.Windows.Forms.Keys.Right)
            {
                dir.X = 1;
            }
            if (e.KeyCode == System.Windows.Forms.Keys.Down)
            {
                dir.Y = 1;
            }
            if (e.KeyCode == System.Windows.Forms.Keys.Up)
            {
                dir.Y = -1;
            }

            if (e.KeyCode == System.Windows.Forms.Keys.R)
            {
                curMap = 0; GameReset();
            }

            if (PointOp.lenght(dir) > 0)
            {
                dir = PointOp.Normalize(ref dir);
                actor.Set_Direction(dir);
            }
        }
Ejemplo n.º 3
0
        public EVR(PointF pos, Game.Actors.Static.Area ar, float scaleArea = 1f, float scaleSprite = 1f)
        {
            Directs.Add(new PointF(1, 0));
            Directs.Add(new PointF(0, 1));
            Directs.Add(PointOp.Normalize(new PointF(1, 1)));
            Directs.Add(new PointF(-1, 0));
            Directs.Add(new PointF(0, -1));
            Directs.Add(PointOp.Normalize(new PointF(-1, -1)));

            Directs.Add(PointOp.Normalize(new PointF(1, 1)));
            Directs.Add(PointOp.Normalize(new PointF(-1, 1)));
            Directs.Add(PointOp.Normalize(new PointF(1, -1)));
            Directs.Add(PointOp.Normalize(new PointF(-1, -1)));



            this.Pos  = pos;
            Shape     = new SquareShape(scaleArea);
            area      = ar;
            Sprite    = new SquareSprite(PointOp.Mul(MainGame.CellSize, scaleSprite), Brushes.Brown);
            Direction = Directs[0];

            Speed = 0.06f;
        }
Ejemplo n.º 4
0
 public Decal(PointF pos, Image sprite, float scaleSprite = 1.05f)
 {
     this.Pos = pos;
     Sprite   = new ImageSprite(sprite, PointOp.Mul(MainGame.CellSize, scaleSprite));
 }
Ejemplo n.º 5
0
        public void LoadMap(int curMap)
        {
            Factory.ClearUnits();
            Bitmap bmp = Maps[curMap];

            for (int y = 0; y < bmp.Height; y++)
            {
                Factory.SetHiddenWall(new PointF(-1, y));
                Factory.SetHiddenWall(new PointF(bmp.Height, y));
            }
            for (int x = 0; x < bmp.Width; x++)
            {
                Factory.SetHiddenWall(new PointF(x, -1));
                Factory.SetHiddenWall(new PointF(x, bmp.Width));
            }

            actor = new Actor();
            Factory.RegistrNewUnit(actor);

            for (int y = 0; y < bmp.Height; y++)
            {
                for (int x = 0; x < bmp.Width; x++)
                {
                    string cell    = bmp.GetPixel(x, y).Name;
                    PointF CellPos = new PointF(x, y);

                    if (x == 0 && y == 0)
                    {
                        cell = bmp.GetPixel(0, 1).Name;
                    }

                    switch (cell)
                    {
                    case "ff000000":
                        Factory.SetWall(CellPos);
                        break;

                    case "ffff0000":
                        StartPos = CellPos;
                        break;

                    case "ff00ff00":
                        Factory.SetExitArea(CellPos);
                        break;

                    case "ffffff00":
                        Factory.SetBaseEnemy(CellPos);
                        break;

                    case "ff0000ff":
                        Factory.SetDecal(CellPos);
                        break;

                    case "ffff00ff":
                        Factory.SetDmgArea(CellPos);
                        break;
                    }
                }
            }
            bg = bmp.GetPixel(0, 0);

            Inform.Set_Pos(new PointF());

            actor.Set_Pos(StartPos);
            actor.Set_Sprite(new SquareSprite(PointOp.Mul(CellSize, 0.5f)));
            actor.Set_Shape(new SquareShape(0.5f));
            actor.Set_Speed(0.12f);

            GameIdle = true;
        }