So I've been working on this game and right now, I'm trying to get some text to show up that prints a math problem. However, it doesn't seem to work. COuld anybody help?
private void randomQuestions()
{
a = Greenfoot.getRandomNumber(20) + 1;
b = Greenfoot.getRandomNumber(20) + 1;
c = Greenfoot.getRandomNumber(100) + 1;
if (c<50)
{
text = "What is " + a + "+" + b;
MyWorld world = (MyWorld)getWorld();
world.showText(text, 100, 400);
}
else if (c>50)
{
if (a>b)
{
text = "What is " + a + "-" + b;
MyWorld world = (MyWorld)getWorld();
world.showText(text, 100, 400);
}
else
{
text = "What is " + b + "-" + a;
MyWorld world = (MyWorld)getWorld();
world.showText(text, 100, 400);
}
}
}
