Bob Outfitter movement

Hello coders, I just want to apologize if this is a duplicate topic that has already been addressed. I ran across 2 through my scroll of the forums that didn’t address the issue I am having. In my code snipit I adjusted bob’s x and y coord’s and also created the if…else statement controlling whether or not the movement keys are being pressed. Up until I added upArrow the thing was loading just fine and once i added that line of code the page will not load or if it does load bob will not move up but he will move every other direction. Any feedback would be appreciated, thank you in advance.

    // Arrow keys that will move Bob in 4 directions
    const cursors = this.input.keyboard.createCursorKeys();
    // Add variables that store if a specific arrow key is being pressed
    const rightArrow = cursors.right.isDown;
    const leftArrow = cursors.left.isDown;
    const upArrow = cursors.up.isDown;
    const downArrow = cursors.up.isDown;

    // Add code to check whether any of the arrow keys were pressed, move Bob
if(rightArrow === true){
} else if(leftArrow === true){
} else if(downArrow === true){
} else if(upArrow === true){

    // Add variables that store the x and y coordinates of the Bob sprite
const bobXCoord = gameState.player.x
const bobYCoord = gamestate.player.y

Project link:


At least you have a typo in the line const downArrow = cursors.up.isDown;. Change it to const downArrow = cursors.down.isDown;

1 Like

Thank you for the help, apparently I miss simple things. Haha I thought BobOutfitter was bugged out.