Building a platformer game

I am at a loss on step 111. Any help would be greatly appreciated. The problem is in my else if statement.

if (index === checkpoints.length - 1) {
        isCheckpointCollisionDetectionActive = false;
        showCheckpointScreen("You reached the final checkpoint!");
        movePlayer("ArrowRight", 0, false);
      }else if (player.position.x >= checkpoint.position.x && checkpoint.position.x <= + 40)
       {
      showCheckpointScreen("You reached a checkpoint!");
    }
    }
  });
}

Please post a link to the Step. Also, please talk to us more about what is the instructions is confusing. Thanks

I am at a loss on step 111. Any help would be greatly appreciated. The problem is in my else if statement.

if (index === checkpoints.length - 1) {
        isCheckpointCollisionDetectionActive = false;
        showCheckpointScreen("You reached the final checkpoint!");
        movePlayer("ArrowRight", 0, false);
      }else if (player.position.x >= checkpoint.position.x && player.position.x <= + 40)
       {
      showCheckpointScreen("You reached a checkpoint!");
    }
    }
  });
}

Hi @ridgerunner

The first part of your condition is correct. The second part is missing a little something.

Try putting into words what the condition is checking.

Happy coding

1 Like

Am I heading in the right direction?

else if (player.position.x >= checkpoint.position.x, player.position.x <= checkpoint.position.x + 40)
       {
      showCheckpointScreen("You reached a checkpoint!");
    }

Thank you Teller. I just figured it out!

2 Likes