diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index abbc216..d46467f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,24 +23,9 @@ pages: - "docs/**/*" - "mkdocs.yml" - ".gitmodules" - -game: - stage: deploy - tags: - - hva - script: - - time cp -rf web public - - time cp -rf webdev public - - artifacts: - paths: - - public - rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - changes: - - web/**/*" + - "web/**/*" - "webdev/**/*" - - ".gitmodules" + variables: diff --git a/webdev/game.js b/webdev/game.js index e1ff54e..87320f5 100644 --- a/webdev/game.js +++ b/webdev/game.js @@ -2,7 +2,7 @@ let port; let reader; const decoder = new TextDecoder("utf-8"); let readibleoutput = 0; - +let booleanArray = []; // Request a port and open a connection. async function connect() { //vraag aan de browser om een serial port te selecteren @@ -40,7 +40,7 @@ async function readLoop() { if (Array.isArray(SerialArray)) { //Convert the array of strings to a boolean array //When a bit is 1 it becomes true, when a bit is 0 it becomes false - let booleanArray = SerialArray.map(bit => bit == '1'); + booleanArray = SerialArray.map(bit => bit == '1'); console.log(booleanArray); } else { console.error("Dit is geen Array"); @@ -48,7 +48,7 @@ async function readLoop() { } catch (e) { console.log("json niet geparserd"); } - + Movementloop() buffer = []; } if (done) { @@ -71,23 +71,25 @@ async function disconnect() { let Playerposx = 500; let Playerposy = 300; -if (booleanArray) { - if (booleanArray[1]) { - Playerposx += 1;} - if (booleanArray[3]) { - Playerposx -= 1;} - if (booleanArray[0]) { - Playerposy += 1;} - if (booleanArray[2]) { - Playerposy -= 1;} - + + +async function Movementloop() { +if (booleanArray[1]) { + Playerposx += 2;} +if (booleanArray[3]) { + Playerposx -= 2;} +if (booleanArray[2]) { + Playerposy += 2;} +if (booleanArray[0]) { + Playerposy -= 2;} } + // the function setup() is called once when the page is loaded function setup(){ // create a canvas element and append it to the body createCanvas(1250, 600); - + frameRate(244); // disable the outline of shapes noStroke(); }