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/**/*"
|
||||
- "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:
|
||||
|
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user