Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();

            // Initialize timer used for 'Update' method
            InitializeTimer();

            // Generate the list of words from a text file
            WordGenerator.ReadWordList("google-10000-english-no-swears.txt");

            // Update the score and lives on the canvas
            UpdateScore(totalScore);
            UpdateLives(lives);

            // Set the speed of the game according to the difficulty selected on the main menu
            switch (MainMenu.difficultyLevel)
            {
            case "Easy":
                difficultySpeed = 10;
                break;

            case "Normal":
                difficultySpeed = 20;
                break;

            case "Hard":
                difficultySpeed = 30;
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        private int scoreToAdd = 0; // The longer the word the more score needs to be added

        // Generate a new random word and add it to the list
        public void AddWord()
        {
            Word word = new Word(WordGenerator.GetRandomWord());

            words.Add(word);
        }