Given the code has different boolean values for each condition, is it okay to leave the code the way it is or is it duplicated code and needs fixing? Code is in Java.
Edit: I think I should have said this code is for a Tetris game. So the boolean values will be used in the update and draw method.
if(e.getKeyCode() == KeyEvent.VK_RIGHT && keyCount == 1)
{
firstForm = false;
secondForm = true;
thirdForm = false;
fourthForm = false;
}
else if(e.getKeyCode() == KeyEvent.VK_RIGHT && keyCount == 2)
{
firstForm = false;
secondForm = false;
thirdForm = true;
fourthForm = false;
}
else if(e.getKeyCode() == KeyEvent.VK_RIGHT && keyCount == 3)
{
firstForm = false;
secondForm = false;
thirdForm = false;
fourthForm = true;
}
else if(e.getKeyCode() == KeyEvent.VK_RIGHT && keyCount == 4)
{
firstForm = true;
secondForm = false;
thirdForm = false;
fourthForm = false;
}