private void Form1_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Space: case Keys.Enter: if (fild.isBlocked()) { if (fild.isWinner()) { ChangeLevel(); break; } } level--; ChangeLevel(); break; case Keys.Down: fild.MoveDown(); fild.drawFild(graphics); break; case Keys.Right: fild.MoveRight(); fild.drawFild(graphics); break; case Keys.Up: fild.MoveUp(); fild.drawFild(graphics); break; case Keys.Left: fild.MoveLeft(); fild.drawFild(graphics); break; } if (fild.isBlocked()) { if (fild.isWinner()) { showWin(); } else { showLoose(); } } }
private void Form1_Shown(object sender, EventArgs e) { graphics = this.CreateGraphics(); looseFrases.Add("Where did I go wrong?.."); looseFrases.Add("Deadlock again?.."); looseFrases.Add("It's so simple!"); fild = new Fild(@"..\..\Levels\" + level.ToString() + ".txt"); fild.drawFild(graphics); }
private void Form1_MouseDoubleClick(object sender, MouseEventArgs e) { int x = e.Location.X; int y = e.Location.Y; fild = new Fild(@"..\..\Levels\" + level.ToString() + ".txt"); fild.SetCursor(x, y, graphics); fild.drawFild(graphics); }
public void ChangeLevel() { if (level == 6) { graphics.Clear(Color.LightBlue); fild = new Fild(); graphics.DrawString("CONGRATULATIONS!\n YOU BEAT\n THE GAME!", new Font("Cooper Black", 50), new SolidBrush(Color.DarkGoldenrod), new PointF(0, 100)); level = 1; return; } level++; fild = new Fild(@"..\..\Levels\" + level.ToString() + ".txt"); fild.drawFild(graphics); }