private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { if (flag) { GameOver(false); } else { Start(); } if (timerCD.Enabled) { cd = 3; lblCD.Text = cd.ToString(); timerCD.Stop(); lblCD.Visible = false; } flag = !flag; } else if (e.KeyCode == Keys.A && !timerCD.Enabled) { if (g.award.UseAddTime()) { g.Time += 1; g.CanMove = true; timer1.Start(); } } else if (e.KeyCode == Keys.S && !timerCD.Enabled) { g.award.UseSlowTime(); } else if (e.KeyCode == Keys.W && !timerCD.Enabled) { g.award.UseNoWall(); g.maze.WhiteCells(g.award.awbNoWall); g.maze.Dig(); g.avatar.maze = g.maze.MazeImage; } else if (e.KeyCode == Keys.J && !timerCD.Enabled) { g.award.UseJump(); g.maze.Dig(); g.avatar.maze = g.maze.MazeImage; } else if (g.CanMove) { if (e.KeyCode == Keys.Left) { g.avatar.rocket = new Bitmap(Properties.Resources.pls); g.avatar.rocket.RotateFlip(RotateFlipType.Rotate90FlipX); g.maze.WhiteCells(false); g.maze.Dig(); g.avatar.maze = g.maze.MazeImage; g.avatar.Move(Side.Left, g.award.awbNoWall); g.award.CancelNoWall(); } else if (e.KeyCode == Keys.Right) { g.avatar.rocket = new Bitmap(Properties.Resources.pls); g.avatar.rocket.RotateFlip(RotateFlipType.Rotate270FlipX); g.maze.WhiteCells(false); g.maze.Dig(); g.avatar.maze = g.maze.MazeImage; g.avatar.Move(Side.Right, g.award.awbNoWall); g.award.CancelNoWall(); } else if (e.KeyCode == Keys.Up) { g.avatar.rocket = new Bitmap(Properties.Resources.pls); g.maze.WhiteCells(false); g.maze.Dig(); g.avatar.maze = g.maze.MazeImage; g.avatar.Move(Side.Top, g.award.awbNoWall); g.award.CancelNoWall(); } else if (e.KeyCode == Keys.Down) { g.avatar.rocket = new Bitmap(Properties.Resources.pls); g.avatar.rocket.RotateFlip(RotateFlipType.RotateNoneFlipY); g.maze.WhiteCells(false); g.maze.Dig(); g.avatar.maze = g.maze.MazeImage; g.avatar.Move(Side.Bottom, g.award.awbNoWall); g.award.CancelNoWall(); } g.award.Consume(g.avatar.Location); } Point p = new Point(g.avatar.Location.X - g.avatar.r, g.avatar.Location.Y - g.avatar.r); g.DrawAll(); CheckFinish(); Awards(); e.Handled = true; e.SuppressKeyPress = true; }