-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathonKeyUp.js
45 lines (45 loc) · 1.54 KB
/
onKeyUp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
window.onkeyup = function(e) { //takes the spacebar as a key input
if (e.key === " ") {
if(stage === "rebuildingShip"){
if(rebuildingShipScanningStage === 2 && pressedButton === false){
if(imageSelection === 0){
if(scanTimes - 0.25 >= 0.25){
scanTimes -= 0.25;
}
pressedButton = true;
}
if(imageSelection === 1){
if(scanTimes + 0.25 <= 3){
scanTimes += 0.25;
}
pressedButton = true;
}
if(imageSelection === 2){
rebuildingShipScanningStage = 1;
pressedButton = true;
imageSelection = 3;
speedCounter = 0;
}
speedLimit = 1500/ scanSpeed / scanTimes;
}
if(rebuildingShipScanningStage === 1 && pressedButton === false){
if(imageSelection === 0){
stage = "map";
}
if(imageSelection === 1){
stage = "map";
}
if(imageSelection === 2){
rebuildingShipScanningStage = 2;
imageSelection = 3;
speedCounter = 0;
}
}
}
else if(stage === "map"){
stage = "rebuildingShip";
imageSelection = 0;
speedCounter = 0;
}
}
}