🧀🏘 Checkpoint

./script.js:9517054/344
This commit is contained in:
Glitch (glitch-hello-website) 2022-03-05 22:02:16 +00:00
parent ecefe02aa2
commit 9c7251f607

View file

@ -96,7 +96,7 @@ function update() {
if (i.down) p.vely += 0.8;
if (i.left) p.velx -= speed;
if (i.right) p.velx += speed;
// update x position
if (move("x", p.velx, p.velx < 0 ? -1 : 1)) {
p.velx = 0;
@ -189,16 +189,20 @@ function update() {
function input(e) {
const i = game.input;
const down = e.type === "keydown";
switch (e.key) {
switch (e.code) {
case "ArrowUp":
case "KeyW":
return (i.up = down);
case "ArrowDown":
case "KeyS":
return (i.down = down);
case "ArrowLeft":
case "KeyA":
return (i.left = down);
case "ArrowRight":
case "KeyD":
return (i.right = down);
case "r":
case "KeyR":
return die();
}
}