private void Timer_Tick(object sender, EventArgs e) { GameLists.CleanTemporaryGameLists(); //lists are cleaned up GameLists.DrawGameObjects(); //all current gameobjects are drawn in their current position GameLists.NewEnemies(playerAndWallSkinSetter); //once the level has been completed, new opponents are generated GameLists.GameObjectMovementAndShoot(); //movement and shoots of the gameobjects GameLists.CheckGameCollision(); //discovers collisions between projectiles and other gameobjects game_Score = string.Format("Score: {0}", GameLists.score); OnPropertyChanged("Game_Score"); //returns the current score game_Level = string.Format("Level: {0}", GameLists.ActualLevel()); OnPropertyChanged("Game_Level"); //returns the current level game_Highscore = string.Format("Highscore: {0}", highscore); OnPropertyChanged("Game_Highscore"); //returns the current highscore game_player_HP = string.Format("Lifes: {0}", GameLists.ActualPLayerHP()); OnPropertyChanged("Game_PlayerHP"); //returns the current player healthpoints if (GameLists.IsGameOver()) { Timer.Stop(); if (highscore < GameLists.score)//checks if the current highscore is smaller than the actual score { highscore = GameLists.score; Writer = new StreamWriter(DataPath); Writer.Write(Convert.ToString(highscore));//saves the new highscore Writer.Close(); game_Highscore = string.Format("Highscore: {0}", highscore); OnPropertyChanged("Game_Highscore");//returns the new highscore } } }
public void StartGame() { Timer.Interval = new TimeSpan(0, 0, 0, 0, 20); Timer.Start(); Reader = new StreamReader(DataPath); highscore = Convert.ToDouble(Reader.ReadToEnd()); Reader.Close();//The Highscore is loaded from a textfile into the Game game_Highscore = string.Format("Highscore: {0}", highscore); OnPropertyChanged("Game_Highscore"); GameLists.difficultyIndex = game_Difficulty; //Level difficulty is updated GameLists.SetLevel(playerAndWallSkinSetter); //Level is generated }
public void ClearGame() { GameLists.ClearGame();//Removes all Gameobjects from the Gamedisplay and resets the Gamevalues }
public bool IsGameOver() { return(GameLists.IsGameOver());//gives a bool value depending on whether the game is lost }