From 273da8e335b5f485bd7dd90f5c1fa7b9b041de63 Mon Sep 17 00:00:00 2001 From: videozane Date: Thu, 26 May 2022 23:09:59 -0700 Subject: [PATCH] Fixed Code Fixed bug where you would just jump forever. --- src/player.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/player.js b/src/player.js index 030ef61..a01a20d 100644 --- a/src/player.js +++ b/src/player.js @@ -151,14 +151,10 @@ export default class Player { this.isMovingLeft = false; this.isMovingRight = false; } - async jump() { - const timer = (ms) => new Promise((res) => setTimeout(res, ms)); - while (this.isJumping) { - if (!this.hasJumped) { + jump() { + if (!this.hasJumped) { this.hasJumped = true; this.velY = this.maxSpeedY; - } - await timer(10); } } dash(orientation, orientations) {