My JavaScript Game: Try it out!

Project: Code Red

Warning: This game was made for a mobile device, but it still works with a PC.


Hopefully, you will like my game! Also, it has no sound atm but when I redo the game, it will have sound! :)

Here's The Link:


Here's my code:

Spoiler Spoiler Warning ▲▼

//Starts the game and rest for it

function resetGame() {

policeOfficeDirection = 0;

 lobbyDirection = -130;

 powerStatus = "On";

 powerReset_I(1);

 powerReset_II(1);

 animation = "No";

 infraredPower = 100;

 random_AI = randomNumber(1, 3);

 creaturePath_I = [ "lobbyLoc", "storageLoc", "storageLoc", "lobbyLoc", "frontHallLoc", "cafeteriaLoc", "backHallLoc", "solitaryLoc", "frontHallLoc", "lobbyLoc", "policeOfficeLoc", "officeEntranceLoc", "officeLoc", "resetAI"];

 creaturePath_II = [ "lobbyLoc", "frontHallLoc", "backHallLoc", "solitaryLoc", "frontHallLoc", "lobbyLoc", "storageLoc", "lobbyLoc", "policeOfficeLoc", "officeEntranceLoc", "officeLoc", "resetAI"];

 creaturePath_III = [ "policeOfficeLoc", "lobbyLoc", "frontHallLoc", "backHallLoc", "cafeteriaLoc", "frontHallLoc", "lobbyLoc", "policeOfficeLoc", "officeEntranceLoc", "officeLoc", "resetAI"];

 if (random_AI == 1) {

  random_AI = creaturePath_I;

 } else if (random_AI == 2) {

  random_AI = creaturePath_II;

 } else if (random_AI == 3) {

  random_AI = creaturePath_III;

 }

 moveCreaturePath = 0;

 doorStatus = 0;

 doorPower = 155;

 check = 0;

 time = 0;

 checkOut = "No";

 setScreen("titleScreen");

 setProperty("doorMeter", "width", doorPower);

 setProperty("infraredBTN_I", "text", "Infrared Sensor: " + infraredPower + "%");

 setProperty("transition_I", "background-color", rgb(0, 0, 0, 0));

 setProperty("policeOfficePicture", "x", 0);

 setProperty("lobbyPicture", "x", -130);

 setProperty("bloodyTimes_I", "background-color", rgb(0, 0, 0, 0));

 setProperty("bloodyTimes_II", "background-color", rgb(0, 0, 0, 0));

 setProperty("bloodyTimes_III", "background-color", rgb(0, 0, 0, 0));

 setProperty("bloodyTimes_IV", "background-color", rgb(0, 0, 0, 0));

 hideElement("bloodyTimes_V");

}

onEvent("startGameBTN", "click", function( ) {

 appScreen = "officeRoom";

 setScreen("officeRoom");

 setProperty("titleBTN_IV", "text", "Loading...");

 setProperty("titleBTN", "text", "Loading...");

 hideElement("titleBTN_II");

 hideElement("BTN_III");

 creatureMovement();

 timeProgression();

});

onEvent("IntroductionBTN", "click", function( ) {

setScreen("howToPlay_I");

});

onEvent("next_I", "click", function( ) {

 setScreen("howToPlay_II");

});

onEvent("next_II", "click", function( ) {

 setScreen("howToPlay_III");

});

onEvent("next_III", "click", function( ) {

 setScreen("howToPlay_IV");

});

onEvent("next_IV", "click", function( ) {

 setScreen("howToPlay_V");

});

onEvent("next_V", "click", function( ) {

 setScreen("howToPlay_VI");

});

onEvent("next_VI", "click", function( ) {

 setScreen("titleScreen");

});


//Credits & Introduction

onEvent("creditBTN", "click", function( ) {

 setScreen("creditScreen");

});

onEvent("titleBTN_I", "click", function( ) {

 setScreen("titleScreen");

});

onEvent("titleBTN_II", "click", function( ) {

 setScreen("titleScreen");

 resetGame();

});

onEvent("titleBTN_III", "click", function( ) {

 setScreen("titleScreen");

 resetGame();

});



//Transitions, animations, cool-downs, and related functions

var appScreen = "titleScreen";

var policeOfficeDirection = 0;

var lobbyDirection = -130;

var powerStatus = "On";

var animation = "No";

var check_I = 0;

function Transition_In(transition,end, screen) {

 speed(99);

 setProperty(end, "background-color", rgb(0, 0, 0, 1));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.1));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.2));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.3));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.4));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.5));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.6));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.7));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.8));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.9));

 setProperty(transition, "background-color", rgb(0, 0, 0, 1));

 setScreen(screen);

 speed(100);

}

function Transition_Out(transition) {

 speed(99);

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.9));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.8));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.7));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.6));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.5));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.4));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.3));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.2));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0.1));

 setProperty(transition, "background-color", rgb(0, 0, 0, 0));

 speed(100);

}

function hideShow(Inout, animation_I, animation_II) {

 animation = animation_I;

 if (Inout == 0) {

 hideElement("cameraSystemBTN_I");

 hideElement("cameraSystemBTN_II");

 hideElement("checkEntranceBTN_I");

 hideElement("checkEntranceBTN_II");

 hideElement("policeOfficeBTN_I");

 hideElement("policeOfficeBTN_II");

 hideElement("policeOfficeBTN_III");

 hideElement("infraredBTN_I"); 

 hideElement("rechargeDoorBTN_I");

 hideElement("doorMeter");

 hideElement("doorBTN_I");

 hideElement("checkOutBTN_I");

 hideElement("checkOutBTN_I");

 hideElement("turnLeft_I");

 hideElement("turnRight_I");

 hideElement("turnLeft_II");

 hideElement("turnRight_II");

 hideElement("time_I");

 hideElement("time_II");

 hideElement("time_III");

 hideElement("time_IV");

 hideElement("location_I");

 hideElement("location_II");

 hideElement("location_III");

 hideElement("location_IV");

 } else {

 showElement("cameraSystemBTN_II");

 showElement("checkEntranceBTN_I");

 showElement("checkEntranceBTN_II");

 showElement("policeOfficeBTN_I");

 showElement("policeOfficeBTN_II");

 showElement("policeOfficeBTN_III");

 showElement("checkOutBTN_I");

 showElement("turnLeft_I");

 showElement("turnRight_I");

 showElement("turnLeft_II");

 showElement("turnRight_II");

 if (powerStatus == "On") {

  showElement("checkOutBTN_I");

  showElement("rechargeDoorBTN_I");

  showElement("cameraSystemBTN_I");

  showElement("doorMeter");

  showElement("time_I");

  showElement("time_II");

  showElement("time_III");

  showElement("time_IV");

  showElement("location_I");

  showElement("location_II");

  showElement("location_III");

  showElement("location_IV");

 }

 if (doorPower - 55 > 0) {

  showElement("doorBTN_I");

 }

 if (infraredPower > 0) {

  showElement("infraredBTN_I");

 }

 }

 animation = animation_II;

}

function moving_I() {

 var moveDirection_I = setTimeout(function() {

   if (policeOfficeDirection != 0) {

    policeOfficeDirection = policeOfficeDirection + 10;

    setProperty("policeOfficePicture", "x", policeOfficeDirection);

    hideElement("policeOfficeBTN_II");

    hideElement("rechargeDoorBTN_I");

    hideElement("doorMeter");

    hideElement("turnRight_I");

    hideElement("turnLeft_I");

    moving_I();

   } else {

    if (powerStatus == "On") {

     showElement("rechargeDoorBTN_I");

     showElement("doorMeter");

        }

    showElement("policeOfficeBTN_II");

    showElement("turnRight_I");

    showElement("turnLeft_I");

    clearTimeout(moveDirection_I);

   }

  }, 25);

}

function moving_II() {

   if (policeOfficeDirection != -230) {


    policeOfficeDirection = policeOfficeDirection - 10;

    setProperty("policeOfficePicture", "x", policeOfficeDirection);

    hideElement("policeOfficeBTN_II");

    hideElement("rechargeDoorBTN_I");

    hideElement("doorMeter");

    hideElement("turnLeft_I");

    hideElement("turnRight_I");

    moving_II();

   } else {

    if (powerStatus == "On") {

     showElement("rechargeDoorBTN_I");

     showElement("doorMeter");

    }

    showElement("policeOfficeBTN_II");

    showElement("turnLeft_I");

    showElement("turnRight_I");

    clearTimeout(moveDirection_II);

   }

  }, 25);

}

function moving_III() {

 var moveDirection_III = setTimeout(function() {

    if (lobbyDirection != 0) {

     lobbyDirection = lobbyDirection + 10;

     setProperty("lobbyPicture", "x", lobbyDirection);

     hideElement("policeOfficeBTN_III");

     hideElement("checkOutBTN_I");

     hideElement("turnLeft_II");

     hideElement("turnRight_II");

     moving_III();

    } else {

     if (powerStatus == "On") {

      showElement("checkOutBTN_I");

     }

     showElement("turnLeft_II");

     showElement("turnRight_II");

     clearTimeout(moveDirection_III);

    }

   }, 25);

}

function moving_IV() {

 var moveDirection_IV = setTimeout(function() {

    if (lobbyDirection != -130) {

     lobbyDirection = lobbyDirection - 10;

     setProperty("lobbyPicture", "x", lobbyDirection);

     hideElement("checkOutBTN_I");

     hideElement("turnLeft_II");

     hideElement("turnRight_II");

     moving_IV();

    } else {

     showElement("policeOfficeBTN_III");

     showElement("checkOutBTN_I");

     showElement("turnLeft_II");

     showElement("turnRight_II");

     clearTimeout(moveDirection_IV);

    }

   }, 25);

}

function powerReset_I(Input_I) {

 if (Input_I == 0) {

  showElement("darkness_V");

  hideElement("checkOutBTN_I");

  hideElement("doorMeter");

  hideElement("rechargeDoorBTN_I");

  hideElement("cameraSystemBTN_I");

  hideElement("time_I");

  hideElement("time_II");

  hideElement("time_III");

  hideElement("time_IV");

  hideElement("location_I");

  hideElement("location_II");

  hideElement("location_III");

  hideElement("location_IV");

 } else if (Input_I == 1) {

  hideElement("darkness_V");

  showElement("checkOutBTN_I");

  showElement("doorMeter");

  showElement("rechargeDoorBTN_I");

  showElement("cameraSystemBTN_I");

  showElement("time_I");

  showElement("time_II");

  showElement("time_III");

  showElement("time_IV");

  showElement("location_I");

  showElement("location_II");

  showElement("location_III");

  showElement("location_IV");

 }

}

function powerReset_II(Input_II) {

 if (Input_II == 0) {

  setProperty("darkness_I", "background-color", rgb(0, 0, 0, 0.9));

  setProperty("darkness_II", "background-color", rgb(0, 0, 0, 0.9));

  setProperty("darkness_III", "background-color", rgb(0, 0, 0, 0.7));

  setProperty("darkness_IV", "background-color", rgb(0, 0, 0, 0.5));

 } else if (Input_II == 1) {

  setProperty("darkness_I", "background-color", rgb(0, 0, 0, 0));

  setProperty("darkness_II", "background-color", rgb(0, 0, 0, 0));

  setProperty("darkness_III", "background-color", rgb(0, 0, 0, 0));

  setProperty("darkness_IV", "background-color", rgb(0, 0, 0, 0));

 }

}

function powerReset(Input_I, Input_II, Input_III, Input_IV) {

 powerStatus = "Off";

 powerReset_I(Input_I);

 powerReset_II(Input_II);

 setTimeout(function() {

 powerStatus = "On";

 powerReset_I(Input_III);

 powerReset_II(Input_IV);

 }, randomNumber(20000, 40000));

}

onEvent("cameraSystemBTN_I", "click", function( ) {

 appScreen = "cameraSystem";

 hideShow(0, "Yes", "Yes");

 Transition_In("transition_I", "transition_II", "cameraSystem");

 Transition_Out("transition_II");

 hideShow(1, "Yes", "No");

});

onEvent("cameraSystemBTN_II", "click", function( ) {

 appScreen = "officeRoom";

 showElement("time_I");

 hideShow(0, "Yes", "Yes");

 Transition_In("transition_II", "transition_I", "officeRoom");

 Transition_Out("transition_I");

 hideShow(1, "Yes", "No");

});

onEvent("checkEntranceBTN_I", "click", function( ) {

 appScreen = "outsideOffice";

 if (creatureLocation != "officeEntranceLoc" || doorStatus == 1) {

  hideShow(0, "Yes", "Yes");

  Transition_In("transition_I", "transition_III", "outsideOffice");

  Transition_Out("transition_III");

  hideShow(1, "Yes", "No");

 } else {

  checkGameOver(1);

 }

});

Comments

  • Fun Fact: This is my first time using a PC on the forums! It's really cool!

    Here's my code: Continued

    Spoiler Spoiler Warning ▲▼

    onEvent("checkEntranceBTN_II", "click", function( ) {

     appScreen = "officeRoom";

     hideShow(0, "Yes", "Yes");

     Transition_In("transition_III", "transition_I", "officeRoom");

     Transition_Out("transition_I");

     hideShow(1, "Yes", "No");

    });

    onEvent("policeOfficeBTN_I", "click", function( ) {

     if (doorStatus == 0) {

      appScreen = "policeOffice";

      hideShow(0, "Yes", "Yes");

      Transition_In("transition_III", "transition_IV", "policeOffice");

      Transition_Out("transition_IV");

      hideShow(1, "Yes", "No");

     } else if (doorStatus == 1) {

      setProperty("policeOfficeBTN_I", "text", "!Open Doors!");

     }

    });

    onEvent("policeOfficeBTN_II", "click", function( ) {

     if (policeOfficeDirection == 0) {

      appScreen = "outsideOffice";

      hideShow(0, "Yes", "Yes");

      Transition_In("transition_IV", "transition_III", "outsideOffice");

      Transition_Out("transition_III");

      hideShow(1, "Yes", "No");

     } else if (policeOfficeDirection == -230) {

      if (creatureLocation != "lobbyLoc") {

       appScreen = "lobby";

       hideShow(0, "Yes", "Yes");

       Transition_In("transition_IV", "transition_V", "lobby");

       Transition_Out("transition_V");

       hideShow(1, "Yes", "No");

      } else {

       checkGameOver(6);

      }

     }

    });

    onEvent("policeOfficeBTN_III", "click", function( ) {

     if (creatureLocation != "policeOfficeLoc") {

      appScreen = "policeOffice";

      setProperty("checkOutBTN_I", "text", "Check Out >>>");

      hideShow(0, "Yes", "Yes");

      Transition_In("transition_V", "transition_IV", "policeOffice");

      Transition_Out("transition_IV");

      hideShow(1, "Yes", "No");

     } else {

      checkGameOver(3);

     }

    });

    onEvent("turnLeft_I", "click", function( ) {

     if (policeOfficeDirection != 0) {

      setProperty("policeOfficeBTN_II", "text", "<<< Office Entrance");

     }

     moving_I();

    });

    onEvent("turnRight_I", "click", function( ) {

     if (policeOfficeDirection != -230) {

      setProperty("policeOfficeBTN_II", "text", "Lobby Entrance >>>");

     }

     moving_II();

    });

    onEvent("turnLeft_II", "click", function( ) {

     if (lobbyDirection != 0) {

       setProperty("checkOutBTN_I", "x", 5);

       setProperty("checkOutBTN_I", "width", 310);

       setProperty("checkOutBTN_I", "text", "!WARNING! (RESET POWER) !WARNING!");

      }

     moving_III();

    });

    onEvent("turnRight_II", "click", function( ) {

     if (lobbyDirection != -130) {

       setProperty("checkOutBTN_I", "width", 155);

       setProperty("checkOutBTN_I", "x", 160);

       setProperty("checkOutBTN_I", "text", "Check Out >>>");

      }

     moving_IV();

    });

    onEvent("checkOutBTN_I", "click", function( ) {

     if (lobbyDirection == 0) {

      infraredPower = 100;

      setProperty("infraredBTN_I", "text", "Infrared Sensor: " + infraredPower + "%");

      doorPower = 55;

      setProperty("doorMeter", "width", doorPower);

      powerReset(0, 0, 1, 1);

     } else if ((lobbyDirection == -130)) {

      if (checkOut == "Yes") {

       appScreen = "titleScreen";

       resetGame();

       setScreen("youEscaped");

      } else if ("No") {

       setProperty("checkOutBTN_I", "text", "!Not 6AM!");

      }

     }

    });


    //Infrared sensor, creature's A.I, and related functions

    var infraredPower = 100;

    var random_AI = randomNumber(1, 3);

    var creaturePath_I = [ "lobbyLoc", "storageLoc", "storageLoc", "lobbyLoc", "frontHallLoc", "cafeteriaLoc", "backHallLoc", "solitaryLoc", "frontHallLoc", "lobbyLoc", "policeOfficeLoc", "officeEntranceLoc", "officeLoc", "resetAI"];

    var creaturePath_II = [ "lobbyLoc", "frontHallLoc", "backHallLoc", "solitaryLoc", "frontHallLoc", "lobbyLoc", "storageLoc", "storageLoc", "lobbyLoc", "policeOfficeLoc", "officeEntranceLoc", "officeLoc", "resetAI"];

    var creaturePath_III = [ "policeOfficeLoc", "lobbyLoc", "frontHallLoc", "backHallLoc", "cafeteriaLoc", "frontHallLoc", "lobbyLoc", "policeOfficeLoc", "officeEntranceLoc", "officeLoc", "resetAI"];

    var moveCreaturePath = 0;

    if (random_AI == 1) {

     random_AI = creaturePath_I;

    } else if (random_AI == 2) {

     random_AI = creaturePath_II;

    } else if (random_AI == 3) {

     random_AI = creaturePath_III;

    }

    var creatureLocation = random_AI[0 + moveCreaturePath];

    function newCreatureAI() {

     if (random_AI == 1) {

     random_AI = creaturePath_I;

    } else if (random_AI == 2) {

     random_AI = creaturePath_II;

    } else if (random_AI == 3) {

     random_AI = creaturePath_III;

    }

     moveCreaturePath = 0;

    }

    function creatureMovement() {

     var timedLoop_AI_Movement = timedLoop(10000, function() {

      if (appScreen != "titleScreen") {

       creatureLocation = random_AI[0 + moveCreaturePath];

       moveCreaturePath = moveCreaturePath + 1;

       console.log((creatureLocation + " and ") + moveCreaturePath);

       checkGameOver(2);

       checkGameOver(3);

       checkGameOver(4);

       checkGameOver(5);

       if (creatureLocation == "resetAI") {

        random_AI = randomNumber(1, 3);

        newCreatureAI();

       }

      } else {

       stopTimedLoop(timedLoop_AI_Movement);

       check_I = check_I + 1;

       if (check_I == 2) {

        check_I = 0;

        setProperty("titleBTN", "text", "Click anywhere to continue...");

        setProperty("titleBTN_IV", "text", "Click anywhere to continue...");

        showElement("titleBTN_II");

        showElement("titleBTN_III");

       }

      }

     });

    }

    function resetHeatSensor() {

      setTimeout(function() {

       hideElement("cafeteriaLoc");

       hideElement("backHallLoc");

       hideElement("solitaryLoc");

       hideElement("frontHallLoc");

       hideElement("storageLoc");

       hideElement("lobbyLoc");

       hideElement("policeOfficeLoc");

       hideElement("officeEntranceLoc");

       if (infraredPower > 0) {

        showElement("infraredBTN_I");

       }

      }, 5000);

    }

    onEvent("infraredBTN_I", "click", function( ) {

     hideElement("infraredBTN_I");

     infraredPower = infraredPower - randomNumber(4, 8);

     setProperty("infraredBTN_I", "text", "Infrared Sensor: " + infraredPower + "%");

     if (creatureLocation == "storageLoc") {

     showElement("storageLoc");

     resetHeatSensor();

     } else if (creatureLocation == "lobbyLoc") {

     showElement("lobbyLoc");

     resetHeatSensor();

     } else if (creatureLocation == "policeOfficeLoc") {

     showElement("policeOfficeLoc");

     resetHeatSensor();

     } else if (creatureLocation == "cafeteriaLoc") {

     showElement("cafeteriaLoc");

     resetHeatSensor();

     } else if (creatureLocation == "frontHallLoc") {

     showElement("frontHallLoc");

     resetHeatSensor();

     } else if (creatureLocation == "solitaryLoc") {

     showElement("solitaryLoc");

     resetHeatSensor();

     } else if (creatureLocation == "officeEntranceLoc" || creatureLocation == "officeLoc") {

     showElement("officeEntranceLoc");

     resetHeatSensor();

     } else if (creatureLocation == "backHallLoc") {

     showElement("backHallLoc");

     resetHeatSensor();

     }

    });


    //Door function, jump scare, and related functions

    var doorStatus = 0;

    var doorPower = 155;

    var check = 0;

    function checkOutsideDoor() {

     var checkOutsideDoor_I = setTimeout(function() {

      if (appScreen == "outsideOffice" && animation == "No" && check == 0) {

       check = check + 1;

       hideShow(0, "Yes", "Yes");

       Transition_In("transition_III", "transition_III", "outsideOffice");

       hideElement("automaticDoors");

       Transition_Out("transition_III");

       hideShow(1, "Yes", "No");

      } else if (appScreen == "outsideOffice" && check == 0) {

       checkOutsideDoor();

      } else {

       hideElement("automaticDoors");

       clearTimeout(checkOutsideDoor_I);

      }

     }, 1);

    }

    function drainPower() {

     var vPower = setTimeout(function() {

      if (doorPower - 55 == 0) {

       doorStatus = 0;

       checkOutsideDoor();

       checkGameOver(2);

       checkGameOver(3);

       check = 0;

       hideElement("doorBTN_I");

       setProperty("policeOfficeBTN_I", "text", "Police Office");

       hideElement("redBar");

       clearTimeout(vPower);

      } else {

       if (doorStatus == 0) {

        clearTimeout(vPower);

       } else if (doorStatus == 1) {

        doorPower = doorPower - 2;

        console.log(doorPower - 55);

        setProperty("doorMeter", "width", doorPower);

        drainPower();

       }

      }

     }, 1000);

    }

    function checkGameOver(Input) {

     if (Input == 1) {

      if (creatureLocation == "officeEntranceLoc" && doorStatus == 0) {

        setScreen("gameOver");

        appScreen = "titleScreen";

       }

     } else if (Input == 2) {

      if (appScreen == "outsideOffice" && doorStatus == 0 && creatureLocation == "officeEntranceLoc") {

         setScreen("gameOver");

         appScreen = "titleScreen";

        }

     } else if (Input == 3) {

      if (appScreen == "policeOffice" && creatureLocation == "policeOfficeLoc") {

         setScreen("gameOver");

         appScreen = "titleScreen";

        }

     } else if (Input == 4) {

      if (creatureLocation == "officeLoc" && doorStatus == 0) {

         setScreen("gameOver");

         appScreen = "titleScreen";

        }

     } else if (Input == 5) {

      if (creatureLocation == "lobbyLoc" && appScreen == "lobby") {

       setScreen("gameOver");

       appScreen = "titleScreen";

      }

     } else if (Input == 6) {

      if (creatureLocation == "lobbyLoc") {

       setScreen("gameOver");

       appScreen = "titleScreen";

      }

     }

    }

    onEvent("doorBTN_I", "click", function( ) {

     doorStatus = doorStatus + 1;

     if (doorStatus >= 2) {

      doorStatus = 0;

     }

     if (doorStatus == 0) {

      if (creatureLocation == "officeLoc") {

       setScreen("gameOver");

       appScreen = "titleScreen";

      }

      setProperty("policeOfficeBTN_I", "text", "Police Office");

      hideElement("automaticDoors");

      hideElement("redBar");

     } else if (doorStatus == 1) {

      showElement("automaticDoors");

      showElement("redBar");

      drainPower();

     }

    });

    onEvent("rechargeDoorBTN_I", "click", function( ) {

     if (doorPower != 155) {

      doorPower = doorPower + 2;

      setProperty("doorMeter", "width", doorPower);

     }

    });


    //In-game time and bloody time's animation

    var time = 0;

    var checkOut = "No";

    function timeCheck() {

     var timeProgression = setTimeout(function() {

      if (animation == "No") {

       if (appScreen == "officeRoom") {

        clearTimeout(timeProgression);

        Transition_In("transition_I", "transition_I", "officeRoom");

        bloodyTimes();

        Transition_Out("transition_I");

        hideShow(1, "Yes", "No");

       } else if (appScreen == "outsideOffice") {

        clearTimeout(timeProgression);

        Transition_In("transition_III", "transition_III", "outsideOffice");

        bloodyTimes();

        Transition_Out("transition_III");

        hideShow(1, "Yes", "No");

       } else if (appScreen == "policeOffice") {

        clearTimeout(timeProgression);

        Transition_In("transition_IV", "transition_IV", "policeOffice");

        bloodyTimes();

        Transition_Out("transition_IV");

        hideShow(1, "Yes", "No");

       } else if (appScreen == "lobby") {

        clearTimeout(timeProgression);

        Transition_In("transition_V", "transition_V", "lobby");

        bloodyTimes();

        Transition_Out("transition_V");

        hideShow(1, "Yes", "No");

       } else if (appScreen == "cameraSystem") {

        clearTimeout(timeProgression);

        Transition_In("transition_II", "transition_II", "cameraSystem");

        bloodyTimes();

        Transition_Out("transition_II");

        hideShow(1, "Yes", "No");

       }

      } else if (animation == "Yes") {

       timeCheck();

      }

     }, 1);

    }

    function bloodyTimes() {

     setProperty("bloodyTimes_I", "background-color", rgb(255, 0, 75, 0.25));

     setProperty("bloodyTimes_II", "background-color", rgb(255, 0, 75, 0.25));

     setProperty("bloodyTimes_III", "background-color", rgb(255, 0, 75, 0.25));

     setProperty("bloodyTimes_IV", "background-color", rgb(255, 0, 75, 0.25));

     setProperty("bloodyTimes_V", "background-color", rgb(255, 0, 75, 0.25));

     setProperty("time_I", "text-color", "red");

     setProperty("time_II", "text-color", "red");

     setProperty("time_III", "text-color", "red");

     setProperty("time_IV", "text-color", "red");

     setProperty("location_I", "text-color", "red");

     setProperty("location_II", "text-color", "red");

     setProperty("location_III", "text-color", "red");

     setProperty("location_IV", "text-color", "red");

     showElement("officeRoomBT");

    }

    function changeTime(time, AM) {

     setProperty("time_I", "text", time + AM);

     setProperty("time_II", "text", time + AM);

     setProperty("time_III", "text", time + AM);

     setProperty("time_IV", "text", time + AM);

    }

    function timeProgression() {

     var timeProgression_I = setTimeout(function() {

      if (appScreen != "titleScreen") {

       time = time + 15;

       console.log("Time: " + time);

       if (time == 120) {

        changeTime(1, "AM:");

       } else if (time == 180) {

        changeTime(2, "AM:");

       } else if (time == 240) {

        changeTime(3, "AM:");

       } else if (time == 300) {

        changeTime(4, "AM:");

       } else if (time == 360) {

        changeTime(5, "AM:");

        timeCheck();

       } else if (time == 480) {

        checkOut = "Yes";

        changeTime(6, "AM:");

        clearTimeout(timeProgression_I);

       }

       timeProgression();

      } else {

       clearTimeout(timeProgression_I);

       check_I = check_I + 1;

       if (check_I == 2) {

        time = 0;

        check_I = 0;

        changeTime("Mid", "night:");

        setProperty("titleBTN", "text", "Click anywhere to continue...");

        setProperty("titleBTN_IV", "text", "Click anywhere to continue...");

        showElement("titleBTN_II");

        showElement("titleBTN_III");

       }

      }

     }, 15000);

    }

  • Screenshot_20190511-195354_Gallery.jpg

    I'm kidding, sorry if it seemed mean :P

  • @NMCKE I’ve done some basic stuff with code.

  • @GrootDude said:

    @NMCKE I’ve done some basic stuff with code.

    @TreemanXD

    I learned how to code from taking AP Computer Science Principles. It's a great class to be honest, and it's not even that hard to warrant the "AP" tag.


    @PhantomMask20763 said:

    @NMCKE I have not

    @PhantomMask20763

    I recommend you to give it a try. Don't be discouraged from my code, you have to start off small then make your way up with the coding language! :)

  • @GrootDude said:

    @NMCKE is it free?

    @TreemanXD

    If you're in highschool, check to see if they offer AP Computer Science Principles, or if you're in college, check your college if they have it as well. College isn't free of course and taking an AP course also isn't free, because there's a test that costs $100 to take. However, that $100 is usually paid off by federal programs so you should be good. Taking AP courses in high school will help you skip rudimentary courses in college so it's a win-win imo.

  • @NMCKE said:

    https://forum.deadbydaylight.com/en/discussion/comment/471512#Comment_471512

    @TreemanXD

    If you're in highschool, check to see if they offer AP Computer Science Principles, or if you're in college, check your college if they have it as well. College isn't free of course and taking an AP course also isn't free, because there's a test that costs $100 to take. However, that $100 is usually paid off by federal programs so you should be good. Taking AP courses in high school will help you skip rudimentary courses in college so it's a win-win imo.

    I am homeschooled, It wouldn’t be too hard to find something to learn code if I tried. (I think)

  • @GrootDude said:

    https://forum.deadbydaylight.com/en/discussion/comment/471518#Comment_471518

    I am homeschooled, It wouldn’t be too hard to find something to learn code if I tried. (I think)

    @TreemanXD

    Try making an account in code.org. My professor made everyone an account, but I'm not sure if you can make your own. Therefore, it's worth a try if you're ever interested in learning code!

  • @NMCKE said:

    https://forum.deadbydaylight.com/en/discussion/comment/471524#Comment_471524

    @TreemanXD

    Try making an account in code.org. My professor made everyone an account, but I'm not sure if you can make your own. Therefore, it's worth a try if you're ever interested in learning code!

    Thanks, I’ll bookmark this thread so I can find the like if I get interested.