예제 #1
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);
            }
        }
예제 #2
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;
        }