D
Dazzy
Guest
Hi, yeah so I've been trying to get some multiple choice questions into my game. The thing it's supposed to do is 1. pick a random question 2. pick four random answers where one of them is the correct one, it shouldn't be choosing two of the same answers. But that's, unfortunately, the case. Here's the code where it picks a random answer out of four, while looking at what the previously chosen answers are.
GML:
if (global.variableans1 == 1 ^^ global.variableans2 == 1)
{
sprite_index = choose(ans1wrong1,ans1wrong2,ans1wrong3);
}
else if (global.variableans1 == 2 ^^ global.variableans2 == 2)
{
sprite_index = choose(ans1correct,ans1wrong2,ans1wrong3);
}
else if (global.variableans1 == 3 ^^ global.variableans2 == 3)
{
sprite_index = choose(ans1correct,ans1wrong1,ans1wrong3);
}
else if (global.variableans1 == 4 ^^ global.variableans2 == 4)
{
sprite_index = choose(ans1correct,ans1wrong1,ans1wrong2);
}
if (sprite_index == ans1correct)
{
global.variableans3 = 1
}
else if (sprite_index == ans1wrong1)
{
global.variableans3 = 2
}
else if (sprite_index == ans1wrong2)
{
global.variableans3 = 3
}
else if (sprite_index == ans1wrong3)
{
global.variableans3 = 4
}