Skip to content

Commit

Permalink
Merge pull request hackclub#470 from DevIos01/patch-2
Browse files Browse the repository at this point in the history
Fixed FontSize Error , Fixed Level being Null!
  • Loading branch information
cedric-h committed Oct 20, 2022
2 parents c822d73 + eaf1711 commit 1b11e6e
Showing 1 changed file with 27 additions and 28 deletions.
55 changes: 27 additions & 28 deletions games/Virtual_Machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,61 +406,63 @@ onInput("w", () => {getFirst(player).y -= 1});
onInput("d", () => {getFirst(player).x += 1});
onInput("a", () => {getFirst(player).x -= 1});


//======================HEADER============================
addText("-Virtual Machine-");
try {
addText("-L to go back-", { y:15, color: [0, 0, 0] }).fontsize(2);
} catch(exception) {}
//========================================================


afterInput(() => {
//========================================================


//=================DUSTBIN====================
afterInput(() => {
//=================DUSTBIN====================


const target2 = tilesWith(dustbin).length;
const check2 = tilesWith(dustbin, player).length;
if (check2 === target2) {
level = level + 2
if (check2 > 0) {
level = 2

console.log("Load trash");

const currentLevel = levels[level];
if (currentLevel !== "") {
setMap(currentLevel);}
setMap(currentLevel);
return;
}
}

//=================SKULL====================
//=================SKULL====================


const target3 = tilesWith(skull).length;
const check3 = tilesWith(skull, player).length;
if (check3 === target3) {
level = level + 3
if (check3 > 0) {
level = 3
const currentLevel = levels[level];
if (currentLevel !== "") {
setMap(currentLevel);
addText("-HACKED-", { y: 4, color: [0, 0, 0] })

addText("-HACKED-", { y: 4, color: [0, 0, 0] });
return;
}
}

//=================POWER====================
//=================POWER====================


const target4 = tilesWith(power).length;
const check4 = tilesWith(power, player).length;
if (check4 === target4) {
level = level + 4
if (check4 > 0) {
level = 4

const currentLevel = levels[level];

if (currentLevel !== "") {
setMap(currentLevel);
addText(" LOGGED OUT ", { y: 7, color: [0, 0, 0] })}
addText(" LOGGED OUT ", { y: 7, color: [0, 0, 0] });
return;
}
}
//===================================================================================

//======================HEADER============================
addText("-Virtual Machine-");
addText("-L to go back-", { y:15, color: [0, 0, 0] }).fontsize(2);
//========================================================

});


Expand All @@ -470,6 +472,3 @@ onInput("l", () => {
clearText();
setMap(currentLevel);
});



0 comments on commit 1b11e6e

Please sign in to comment.