private void CarSpawn_Tick(object sender, EventArgs e) { stage.addCar(rnd.Next(4), rnd.Next(8)); if (stage.checkJam()) { NextMove.Stop(); CarSpawn.Stop(); ManSpawn.Stop(); GameOver go = new GameOver(defOptions, "TRAFFIC JAM"); go.StartPosition = FormStartPosition.CenterScreen; go.ShowDialog(); if (go.nova == true) { stage = new Stage(defOptions); NextMove.Start(); CarSpawn.Start(); ManSpawn.Start(); Invalidate(); } else { this.Close(); } } }
private void NextMove_Tick(object sender, EventArgs e) { lblScore.Text = Stage.score.ToString(); pCars = stage.checkCollisionCars(); pMan = stage.checkCollisionMan(); if (!pCars.IsEmpty) { NextMove.Stop(); CarSpawn.Stop(); ManSpawn.Stop(); Delay.Start(); Graphics g = CreateGraphics(); stage.drawBam(pCars, g); } else if (!pMan.IsEmpty) { NextMove.Stop(); CarSpawn.Stop(); ManSpawn.Stop(); Delay.Start(); if (defOptions.sound == true) { scream.Play(); } Graphics g = CreateGraphics(); Image blood = (Bitmap)Resources.tomato.Clone(); g.DrawImage(blood, pMan.X - 10, pMan.Y - 10, blood.Width / 3, blood.Height / 3); } else { stage.move(); stage.inCollisionArea(); Invalidate(); } }
private void NewGame_FormClosing(object sender, FormClosingEventArgs e) { NextMove.Stop(); CarSpawn.Stop(); ManSpawn.Stop(); }