Merge branch 'main' of ssh://gitlab.fdmci.hva.nl/propedeuse-hbo-ict/onderwijs/2023-2024/out-a-se-ti/blok-2/cuujooceevii61
This commit is contained in:
@@ -23,24 +23,9 @@ pages:
|
|||||||
- "docs/**/*"
|
- "docs/**/*"
|
||||||
- "mkdocs.yml"
|
- "mkdocs.yml"
|
||||||
- ".gitmodules"
|
- ".gitmodules"
|
||||||
|
- "web/**/*"
|
||||||
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/**/*"
|
|
||||||
- "webdev/**/*"
|
- "webdev/**/*"
|
||||||
- ".gitmodules"
|
|
||||||
|
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
|
@@ -2,7 +2,7 @@ let port;
|
|||||||
let reader;
|
let reader;
|
||||||
const decoder = new TextDecoder("utf-8");
|
const decoder = new TextDecoder("utf-8");
|
||||||
let readibleoutput = 0;
|
let readibleoutput = 0;
|
||||||
|
let booleanArray = [];
|
||||||
// Request a port and open a connection.
|
// Request a port and open a connection.
|
||||||
async function connect() {
|
async function connect() {
|
||||||
//vraag aan de browser om een serial port te selecteren
|
//vraag aan de browser om een serial port te selecteren
|
||||||
@@ -40,7 +40,7 @@ async function readLoop() {
|
|||||||
if (Array.isArray(SerialArray)) {
|
if (Array.isArray(SerialArray)) {
|
||||||
//Convert the array of strings to a boolean array
|
//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
|
//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);
|
console.log(booleanArray);
|
||||||
} else {
|
} else {
|
||||||
console.error("Dit is geen Array");
|
console.error("Dit is geen Array");
|
||||||
@@ -48,7 +48,7 @@ async function readLoop() {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("json niet geparserd");
|
console.log("json niet geparserd");
|
||||||
}
|
}
|
||||||
|
Movementloop()
|
||||||
buffer = [];
|
buffer = [];
|
||||||
}
|
}
|
||||||
if (done) {
|
if (done) {
|
||||||
@@ -71,23 +71,25 @@ async function disconnect() {
|
|||||||
let Playerposx = 500;
|
let Playerposx = 500;
|
||||||
let Playerposy = 300;
|
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
|
// the function setup() is called once when the page is loaded
|
||||||
function setup(){
|
function setup(){
|
||||||
// create a canvas element and append it to the body
|
// create a canvas element and append it to the body
|
||||||
createCanvas(1250, 600);
|
createCanvas(1250, 600);
|
||||||
|
frameRate(244);
|
||||||
// disable the outline of shapes
|
// disable the outline of shapes
|
||||||
noStroke();
|
noStroke();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user