Exemplo n.º 1
0
        // Overridden to process the arrow keys.
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            // This switch statement can be modified to process additional keys if desired.
            switch (keyData)
            {
            case Keys.Up:
                player.MoveEntity(Direction.Up);
                break;

            case Keys.Down:
                player.MoveEntity(Direction.Down);
                break;

            case Keys.Left:
                player.MoveEntity(Direction.Left);
                break;

            case Keys.Right:
                player.MoveEntity(Direction.Right);
                break;

            default:
                break;
            }

            this.Invalidate();

            return(base.ProcessCmdKey(ref msg, keyData));
        }