Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d582a10f2e | ||
|
|
995e8c4dab |
5 changed files with 51 additions and 42 deletions
|
|
@ -21,10 +21,8 @@ and run:
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
### Start the container (in the project root)
|
### Start the container
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
docker compose up --build
|
docker compose up --build
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then access the website on `localhost:8080`
|
|
||||||
|
|
|
||||||
|
|
@ -30,3 +30,4 @@ 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 = true;
|
var ready = false;
|
||||||
|
|
||||||
function preload(){
|
function preload(){
|
||||||
font = loadFont(FONT_PATH);
|
font = loadFont(FONT_PATH);
|
||||||
|
|
@ -67,6 +67,12 @@ 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(){
|
||||||
|
|
@ -161,7 +167,9 @@ function die(){
|
||||||
playTime = Date.now() - startTime;
|
playTime = Date.now() - startTime;
|
||||||
exportToLocalStorage();
|
exportToLocalStorage();
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
return ready = true;
|
if(localStorage.getItem("frontend-ready") == "true"){
|
||||||
|
return ready = true;
|
||||||
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -208,19 +216,20 @@ function checkRaspberryScore(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetScore(){
|
function resetScore(){
|
||||||
if(!hasDied || localStorage.getItem("frontend-ready") == "false")
|
if(!hasDied)
|
||||||
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,6 +39,7 @@ 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://localhost:3000';
|
static readonly URL = 'http://139.144.178.216:3000';
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue