Change the code in your
movePlayer function so that the player moves to the left instead.
Next, we are going to control the player's movement with the keyboard.
We will do this by:
movePlayerfunction to move the player based on the key variables
===means "is this equal to that?"
=means "set this equal to that
x === 7means "does x equal 7?"
x = 7means "set x equal to 7"
Your challenge is to make another input function that uses the "Enter" key. Here are the steps:
interactto false in the
//if the keyCode is ENTER //set interact to true //
//if the keyCode is ENTER //set interact to false //
//if interact is true text("Hello!", player.x, player.y) //