I wanted to create a game where I have to return a baby when baby goes to Y position at 12 using an button. I want it to be move 2 position from 12 i.e. 10 and move from 10 to 6 but the code move the baby directly to 6. Note: grammar error doesn't let me post icon and baby as a same. It is a variable name.
if (baby_posY==12) {
if (baby_posY==12) {
tiles[baby_posX][baby_posY].setIcon(null);
baby_posY=baby_posY-2;
tiles[baby_posX][baby_posY].setIcon(icon Baby);
}
if (baby_posY==10) {
tiles[baby_posX][baby_posY].setIcon(null);
baby_posY=baby_posY-4;
tiles[baby_posX][baby_posY].setIcon(icon Baby);
}
}