Skip to content

Commit

Permalink
Add space to pause
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy-Gonzalez committed Apr 15, 2024
1 parent dff9b75 commit 9c4a24e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions run-simulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ let keyInputData = {
offset: [1, 0],
},
speed: false,
pause: false,
}

let Camera = {
Expand Down Expand Up @@ -86,6 +87,12 @@ function simpleKeyPress(key, pressed) {
case 'ArrowRight':
keyInputData.right.active = pressed;
break;
case ' ':
if (pressed) {
break;
}
keyInputData.pause = !keyInputData.pause;
break;
case 'e':
keyInputData.speed = pressed;
break;
Expand Down Expand Up @@ -417,6 +424,9 @@ function draw() {
if (keyInputData.speed) {
nums = 15;
}
if (keyInputData.pause) {
nums = 0;
}

if (sound) {
sound.playbackRate = nums;
Expand Down

0 comments on commit 9c4a24e

Please sign in to comment.