Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1a32c1a30 | ||
|
|
adc971f587 | ||
|
|
28a3c48cdb | ||
| 7e2ac3f488 |
5 changed files with 42 additions and 51 deletions
|
|
@ -21,8 +21,10 @@ and run:
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
### Start the container
|
### Start the container (in the project root)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
docker compose up --build
|
docker compose up --build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can then access the website on `localhost:8080`
|
||||||
|
|
|
||||||
|
|
@ -30,4 +30,3 @@ services:
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./frontend:/app
|
- ./frontend:/app
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ var score = 0;
|
||||||
var paused;
|
var paused;
|
||||||
var hasAlreadyScored = false;
|
var hasAlreadyScored = false;
|
||||||
var hasDied = true;
|
var hasDied = true;
|
||||||
var ready = false;
|
var ready = true;
|
||||||
|
|
||||||
function preload(){
|
function preload(){
|
||||||
font = loadFont(FONT_PATH);
|
font = loadFont(FONT_PATH);
|
||||||
|
|
@ -67,12 +67,6 @@ function setup(){
|
||||||
window.dispatchEvent(event);
|
window.dispatchEvent(event);
|
||||||
originalSetItem.apply(this, arguments);
|
originalSetItem.apply(this, arguments);
|
||||||
};
|
};
|
||||||
window.addEventListener("itemInserted", e => {
|
|
||||||
if(e.key === "frontend-ready"){
|
|
||||||
ready = e.value === "true";
|
|
||||||
score = 0;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupObstacleConsts(){
|
function setupObstacleConsts(){
|
||||||
|
|
@ -167,9 +161,7 @@ function die(){
|
||||||
playTime = Date.now() - startTime;
|
playTime = Date.now() - startTime;
|
||||||
exportToLocalStorage();
|
exportToLocalStorage();
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
if(localStorage.getItem("frontend-ready") == "true"){
|
|
||||||
return ready = true;
|
return ready = true;
|
||||||
}
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,20 +208,19 @@ function checkRaspberryScore(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetScore(){
|
function resetScore(){
|
||||||
if(!hasDied)
|
if(!hasDied || localStorage.getItem("frontend-ready") == "false")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
hasDied = false;
|
hasDied = false;
|
||||||
score = 0;
|
score = 0;
|
||||||
hasAlreadyScored = false;
|
hasAlreadyScored = false;
|
||||||
startTime = Date.now();
|
startTime = Date.now();
|
||||||
|
exportToLocalStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
function keyPressed(){
|
function keyPressed(){
|
||||||
if(!ready){
|
if(!ready)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if(BOOST_KEYS.includes(key.toLowerCase())){
|
if(BOOST_KEYS.includes(key.toLowerCase())){
|
||||||
resetScore();
|
resetScore();
|
||||||
raspberry.boost();
|
raspberry.boost();
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ export default {
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
this.$emit('userChange', user);
|
this.$emit('userChange', user);
|
||||||
localStorage.setItem("frontend-ready", "true");
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
export class Rest {
|
export class Rest {
|
||||||
static readonly URL = 'http://139.144.178.216:3000';
|
static readonly URL = 'http://localhost:3000';
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue