コード例 #1
0
ファイル: Game.cs プロジェクト: alekseyIsakin/LabGame
        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);
            }
        }