I'm trying to make a simple game where the player can move a sphere by using either wasd or the arrow keys. I have some code which determines playermovement:
function playerMovement(){
if (keyIsDown(UP_ARROW) || keyIsDown(087)) {
print("up");
player.xpos += 0 * player.v;
player.ypos += -1 * player.v
}
if (keyIsDown(DOWN_ARROW) || keyIsDown(083)) {
print("down");
player.xpos += 0 * player.v;
player.ypos += 1 * player.v;
}
if(keyIsDown(RIGHT_ARROW) || keyIsDown(068)) {
print("right");
player.xpos += 1 * player.v;
player.ypos += 0 * player.v;
}
if(keyIsDown(LEFT_ARROW) || keyIsDown(065)) {
print("left")
player.xpos += -1 * player.v;
player.ypos += 0 * player.v;
}
}
The code that is giving me trouble is the
keyIsDown(065)
part! The keycode for the letter a is 065, but when I press a nothing happens. All the other keys work fine! When using print(keyCode) to see what the keyCode for a is, it prints 97. However, changing the code to keyIsDown(097) doesn't work either! I'm very confused what's going on here.