Beispiel #1
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                Application.Exit(); return;
            }
            if (e.KeyCode == Keys.Enter)
            {
                t.Enabled = true;
            }

            if (e.KeyCode == Keys.W)
            {
                left.setY(left.getY() - left.getSpeed());
            }

            if (e.KeyCode == Keys.S)
            {
                left.setY(left.getY() + left.getSpeed());
            }
            if (e.KeyCode == Keys.Up)
            {
                right.setY(right.getY() - right.getSpeed());
            }

            if (e.KeyCode == Keys.Down)
            {
                right.setY(right.getY() + right.getSpeed());
            }
        }