//Pausing the Game private void PauseButton_Click(object sender, EventArgs e) { if (lost == false) { if (pause == true) { pause = false; PauseScreen.Visible = false; PauseButton.Text = "PAUSE"; //Starting all Timers EnemyTimersStart(); FoodCollectionTimer.Start(); } else { pause = true; PauseScreen.Visible = true; PauseButton.Text = "WEITER"; //Stopping all Timers MoveTimersStop(); EnemyTimersStop(); FoodCollectionTimer.Stop(); } } }
private void LostCheckTimer_Tick(object sender, EventArgs e) { if (lost == true) { //Stopping all Timers MoveTimersStop(); EnemyTimersStop(); FoodCollectionTimer.Stop(); //LostScreen LostScreen.Visible = true; } }
//Reset the Game private void ResetButton_Click(object sender, EventArgs e) { //Reset Player XPlayer = 947; YPlayer = 26; Player.Location = new Point(947, 26); //Reset Enemies XEnemy01 = 1070; YEnemy01 = 793; Enemy01.Location = new Point(1070, 793); XEnemy02 = 1050; YEnemy02 = 894; Enemy02First = false; Enemy02.Location = new Point(1050, 894); XEnemy03 = 1340; YEnemy03 = 763; Enemy03.Location = new Point(1340, 763); XEnemy04 = 1340; YEnemy04 = 884; Enemy04.Location = new Point(1340, 884); //Reset Food Location Food01.Location = new Point(random.Next(67, 908), random.Next(67, 908)); Food02.Location = new Point(random.Next(67, 908), random.Next(67, 908)); Food03.Location = new Point(random.Next(67, 908), random.Next(67, 908)); Food04.Location = new Point(random.Next(67, 908), random.Next(67, 908)); Food05.Location = new Point(random.Next(67, 908), random.Next(67, 908)); Food06.Location = new Point(random.Next(67, 908), random.Next(67, 908)); //Reset Food Points Food01CollectionPoints = 50; Food02CollectionPoints = 50; Food03CollectionPoints = 50; Food04CollectionPoints = 50; Food05CollectionPoints = 50; Food06CollectionPoints = 50; //Reset Food Pictures Image Apple = Image.FromFile("asserts\\Apple.png"); Food01.Image = Apple; Food02.Image = Apple; Food03.Image = Apple; Food04.Image = Apple; Food05.Image = Apple; Food06.Image = Apple; //Reset Score score = 0; Scoreboard.Text = "Score: " + score; AppleScore = 0; AppleCounter.Text = "" + AppleScore; PearScore = 0; PearCounter.Text = "" + PearScore; LemonScore = 0; LemonCounter.Text = "" + LemonScore; CherryScore = 0; CherryCounter.Text = "" + CherryScore; GrapeScore = 0; GrapeCounter.Text = "" + GrapeScore; PineappleScore = 0; PineappleCounter.Text = "" + PineappleScore; //Reset Bools lost = false; pause = false; //Reset Labels PauseScreen.Visible = false; LostScreen.Visible = false; //Reset Speed PlayerSpeed = 3; Enemy01Speed = 1; XEnemy02Speed = -3; YEnemy02Speed = -3; Enemy03Speed = 0; Enemy04Speed = 0; //Reset Timer MoveTimersStop(); EnemyTimersStart(); FoodCollectionTimer.Start(); LostCheckTimer.Start(); }