🧀🏘 Checkpoint
./script.js:9517054/344
This commit is contained in:
parent
ecefe02aa2
commit
9c7251f607
1 changed files with 7 additions and 3 deletions
10
script.js
10
script.js
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue