Untitled

Anonymous
plain_text
02/13/2026 7:57 PM
3.7 KB
9
Indexable
// -------------------- SETUP --------------------
// Setting the scene: The Office
setBackgroundImageAs("Office_Background_1"); 

// The Night Watch (Player)
makeNewSpriteAnon("guard", {"x":200,"y":200});
setProp(({costume:"guard"}), "speed", 5);
addBehaviorSimple(({costume:"guard"}), new Behavior(moving_with_arrow_keys, []));

// -------------------- THE ANIMATRONICS --------------------

function spawnSecurityDroids() {
  // These represent the 'Endoskeletons' or hallway threats
  var hallPositions = [[30,304],[28,226],[28,144],[374,106],[370,180],[368,252]];
  
  for (var i = 0; i < hallPositions.length; i++) {
    makeNewSpriteAnon("endoskeleton", {
      "x": hallPositions[i][0],
      "y": hallPositions[i][1]
    });
    setProp(({costume:"endoskeleton"}), "speed", 3);
    addBehaviorSimple(({costume:"endoskeleton"}), new Behavior(patrolling, []));
  }
}

spawnSecurityDroids();

// -------------------- SURVIVAL MECHANICS --------------------

// JUMPSCARE: If any animatronic touches the guard, it's Game Over
checkTouching("when", ({costume:"guard"}), "any_animatronic", function () {
  destroy(({costume:"guard"}));
  setBackgroundImageAs("Jumpscare_Static_Screen"); 
  // Optimization: You can replace "any_animatronic" with specific tags if your engine supports it
});

// -------------------- THE NIGHT PROGRESSION --------------------

// 1 AM: Bonnie (Purple Bunny) enters
atTime(10, "seconds", function () {
  makeNewSpriteAnon("purple bunny", {"x":72,"y":212});
  addBehaviorSimple(({costume:"purple bunny"}), new Behavior(stalking, []));
});

// 3 AM: Chica (The Chick) joins the hunt
atTime(30, "seconds", function () {
  makeNewSpriteAnon("chick_1_1", {"x":148,"y":122});
  setProp(({costume:"chick_1_1"}), "speed", 3);
  addBehaviorSimple(({costume:"chick_1_1"}), new Behavior(wandering, []));
});

// 5 AM: Foxy (The Fox) starts sprinting
atTime(50, "seconds", function () {
  makeNewSpriteAnon("cuteanimals_fox_hello_1", {"x":352,"y":74});
  setProp(({costume:"cuteanimals_fox_hello_1"}), "speed", 6); // Fast like Foxy!
  addBehaviorSimple(({costume:"cuteanimals_fox_hello_1"}), new Behavior(patrolling, []));
});

// -------------------- WIN CONDITION: 6 AM --------------------

atTime(60, "seconds", function () {
  destroy(({costume:"guard"}));
  destroy(({costume:"purple bunny"}));
  destroy(({costume:"chick_1_1"}));
  destroy(({costume:"cuteanimals_fox_hello_1"}));
  setBackgroundImageAs("6AM_Success_Screen");
  print("IT'S 6 AM! YOU SURVIVED.");
});

// -------------------- BEHAVIORS --------------------

function stalking(this_sprite) {
  // Stalking behavior: Moves toward the player slowly
  if (math_random_int(0, 10) == 0) {
    pointTowards(this_sprite, ({costume:"guard"}));
  }
  moveForward(this_sprite, 2);
}

// (Keep your existing wandering, patrolling, and moving_with_arrow_keys functions below)
Editor is loading...
Leave a Comment