Compare commits

..

4 commits

Author SHA1 Message Date
David Hain
c1a32c1a30
fix: README 2024-01-26 14:41:37 +01:00
David Hain
adc971f587
Update docker-compose.yml 2023-02-07 09:10:31 +01:00
Stefan Prechtl
28a3c48cdb
Update README.md 2023-02-05 22:48:26 +01:00
7e2ac3f488 Merge 2023-02-01 19:00:46 +01:00
5 changed files with 42 additions and 51 deletions

View file

@ -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`

View file

@ -30,4 +30,3 @@ services:
volumes: volumes:
- ./frontend:/app - ./frontend:/app

View file

@ -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();

View file

@ -39,7 +39,6 @@ export default {
if (user) { if (user) {
this.$emit('userChange', user); this.$emit('userChange', user);
localStorage.setItem("frontend-ready", "true");
} }
}, },
} }

View file

@ -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';
} }