private void MovePlayer(KeyEventArgs e) { if (e.KeyCode == Keys.Up && player.Top > 30) { Box.UpBoxMove(player, boxes); player.Top -= player.Height; } else if (e.KeyCode == Keys.Down && player.Top < Height - 2 * player.Height) { Box.DownBoxMove(player, boxes); player.Top += player.Height; } else if (e.KeyCode == Keys.Left && player.Left > 30) { Box.LeftBoxMove(player, boxes); player.Left -= player.Width; } else if (e.KeyCode == Keys.Right && player.Left < Width - 2 * player.Width) { Box.RightBoxMove(player, boxes); player.Left += player.Width; } }