if(Greenfoot.isKeyDown("space"))
{
if(isTouching(Cheeseburger.class))
{
if(order == 1)
{
points++;
}
else
{
points++;
}
getWorld().showText("Points:" + points, 100,45);
}
else if(isTouching(ChickenSandwich.class))
{
if(order == 2)
{
points++;
}
else
{
points--;
}
getWorld().showText("Points:" + points, 100,45);
}
else if(isTouching(FrenchFries.class))
{
if(order == 3)
{
points++;
}
else
{
points--;
}
getWorld().showText("Points:" + points, 100,45);
}
else if(isTouching(Soda.class))
{
if(order == 4)
{
points++;
}
else
{
points--;
}
}
}
This code keeps subtracting from the points, even if you click on the right food. The variables were created in another class.