I have two lists which work with an XML file which holds questions and answers. At the moment the project displays all the questions at the same time so they "flicker" on the screen and iterate between each item in the list.
Whats the easiest way (coding) to pause the random generated list on any particular questions?
Question class:
class question
{
public string questionString;
public string apple;
public string pear;
public string orange;
//the ? indicate the int can be nullable so it can accept the string item
int? correctAnswer;
public question(string newquestionString)
{
parseQuestion(newquestionString);
}
public void parseQuestion(string newquestionString)
{
List<string> questionComponents = newquestionString.Split('|').ToList<string>();
questionString = questionComponents[0];
apple = questionComponents[1];
pear = questionComponents[2];
orange = questionComponents[3];
correctAnswer = Int32.Parse(questionComponents[4]);
}
In Game1:
Random q = new Random();
int i = q.Next(questions.Count);
spriteBatch.Begin();
spriteBatch.DrawString(myfont, questions[i], new Vector2(100 + 100 *i, 100), Color.Black);
spriteBatch.DrawString(myfont, myQuestions[i].questionString, new Vector2(100 + 100, 100), Color.Black);
spriteBatch.DrawString(myfont, myQuestions[i].apple, new Vector2(100 + 100, 200), Color.Black);
spriteBatch.DrawString(myfont, myQuestions[i].orange, new Vector2(100 + 100, 300), Color.Black);
spriteBatch.DrawString(myfont, myQuestions[i].pear, new Vector2(100 + 100, 400), Color.Black);
spriteBatch.End();