Code edit (1 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
include also bg_ClownKey, bg_HelpIcon01 and bg_InventoryUI with naughty text
User prompt
instead of naughtytext, show bghelpicon01
Code edit (2 edits merged)
Please save this source code
User prompt
if bg_helpmenu is visible, naughtytext should appear above it, if bg_helpmenu is not visible, naughtytext should not be visible as well.
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'destroy')' in or related to this line: 'naughtyText.destroy();' Line Number: 291
User prompt
the visibility of naughty text should be controlled by a boolean variable `is_naughtytextVisible`. When the help button is pressed and `naughtytext` is not visible, it is created and displayed. If it is already visible, pressing the help button again will destroy `naughtytext`, effectively hiding it.
User prompt
give that same visibility control to naughty text
User prompt
if how-to is pressed again, naughty text should not be visible
User prompt
naughtytext should follow help menu's logic, if help menu is not active, naughty text should not be shown
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
naughty text should be dark red not light red
User prompt
set naughty text's font to brush script mt
User prompt
add black stroke and strokethickness around naughty text
User prompt
add a black underline to naughty text
Code edit (1 edits merged)
Please save this source code
User prompt
naughty text should be above helpmenu
Code edit (1 edits merged)
Please save this source code
User prompt
in the triggerHowToButton function, instantiate red text at the top center of the helpMenu that says "You have been naughty this year.... Can you escape the Krampus?"
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'destroy')' in or related to this line: 'helpMenu.destroy();' Line Number: 225
Code edit (3 edits merged)
Please save this source code
/****
* Classes
****/
// Create a Snowflake class by using the LK expand method to extend Container.
var Snowflake = Container.expand(function () {
var self = Container.call(this);
// Get and automatically addChild to self asset with id 'bg_Snowflake' with the anchor point set to .5, .5
var scale = Math.random() * 0.5 + 0.5; // Random scale between 0.5 and 1
var snowflakeGraphics = self.attachAsset('bg_Snowflake', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: scale,
scaleY: scale
});
// Set snowflake speed
self.speed = Math.random() * 0.5 + 0.5;
// This is automatically called every game tick, if the snowflake is attached!
self.update = function () {
self.y += self.speed;
// If the snowflake is off the screen, destroy it
if (self.y > 2732 || self.x < 0) {
self.destroy();
}
};
});
/****
* Initialize Game
****/
//---------------------------------------------------------------------------------------------------
//create variables for the various assets that will be loaded and unloaded and their various types
//---------------------------------------------------------------------------------------------------
//array for the elements of the menu so that we can easily destroy them or add them to the game
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
loadMenu();
vcr();
//array for the elements of the menu so that we can easily destroy them or add them to the game
var menuObjects = [];
// Call the vcr function to initialize bg_Grain and bg_ScanLine
//---------------------------------------------------------------------------------------------------
//create variables for the various assets that will be loaded and unloaded and their various types
//---------------------------------------------------------------------------------------------------
//array for the elements of the menu so that we can easily destroy them or add them to the game
var menuObjects = [];
//elements of the narration screen so that we can easily destroy or add them to the game
var introObjects = [];
//array for the snowflakes
var snowflakes = [];
//variables for the vcr effect that will hold the various assets of the effect
var grain, scanLines;
// Create a variable to keep track of the flicker state
var is_flickerState = false;
// Define eyeFlash variable
var eyeFlash;
//variable to keep track of if we are in the mainMenu or not
var is_mainMenu = false;
//variable to keep track of the help menu
var is_helpMenuVisible = false;
// Create a variable to keep track of the time elapsed
var timeElapsed = 0;
//------------------------------------------------------------------------------------
//functions for the visual and sound effects
//------------------------------------------------------------------------------------
//function that adds the effect of a vcr screen to the game.
function vcr() {
// Add bg_Grain in the center of the playspace and set its alpha to 20%
grain = game.addChild(LK.getAsset('bg_Grain', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2,
alpha: 0.15
}));
// Instantiate bg_ScanLines in the center of the playspace above bg_grain
scanLines = game.addChild(LK.getAsset('bg_ScanLine', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2,
alpha: 0.12
}));
// Ensure bg_Grain and bg_ScanLines are always on the top layer
game.setChildIndex(grain, game.children.length - 1);
game.setChildIndex(scanLines, game.children.length - 1);
// Function to animate bg_ScanLines
function animateScanLines() {
// Randomly move up or down by a small amount
var jumpHeight = Math.random() * 600 - 300; // Random value between -25 and 25
scanLines.y += jumpHeight;
// Reposition to center after a short delay
LK.setTimeout(function () {
scanLines.x = 2048 / 2;
scanLines.y = 2732 / 2;
}, 1000); // 1 second delay
}
// Set interval to animate bg_ScanLines every few seconds
LK.setInterval(animateScanLines, 3000); // Every 3 seconds
}
//function to add snowflakes on the screen
function createSnowflake() {
var newSnowflake = new Snowflake();
// Ensure the snowflake spawns from the top of the playspace
newSnowflake.x = Math.random() * 2048;
newSnowflake.y = -50;
snowflakes.push(newSnowflake);
game.addChild(newSnowflake);
}
//function to add screams to a scene
function addScream() {
var randomSound = Math.floor(Math.random() * 4);
switch (randomSound) {
case 0:
LK.getSound('s_ManScream01').play();
break;
case 1:
LK.getSound('s_ManScream02').play();
break;
case 2:
LK.getSound('s_WomanScream01').play();
break;
case 3:
LK.getSound('s_WomanScream02').play();
break;
}
}
//--------------------------------------------------------------------------------
//functions that will be for the various loading of the game.
//--------------------------------------------------------------------------------
//a function to load the menu screen
function loadMenu() {
is_mainMenu = true;
// Retrieve the 'bg_TitleScreen' asset and position it at the center of the playspace
var titleScreen = game.addChild(LK.getAsset('bg_TitleScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2 - 100,
y: 2732 / 2
}));
menuObjects.push(titleScreen);
// Play s_splashscreen when the game starts
LK.setTimeout(function () {
LK.playMusic('s_SplashScreen', {
loop: true
});
}, 1000);
// Retrieve the 'bg_TornRope' asset and position it at the bottom middle of the playspace
var tornRope = game.addChild(LK.getAsset('bg_TornRope', {
anchorX: 0.5,
anchorY: 1.0,
x: 2048 / 2,
y: 2832
}));
menuObjects.push(tornRope);
// Retrieve the 'bg_eyeflash' asset, position it at the center of the playspace and set its alpha to 50%
eyeFlash = game.addChild(LK.getAsset('bg_eyeflash', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2 - 75,
y: 2732 / 2 - 100,
alpha: 0.20
}));
menuObjects.push(eyeFlash);
// Retrieve the 'bg_StartButton' asset and position it at the bottom left of the playspace
var startButton = game.addChild(LK.getAsset('bg_StartButton', {
anchorX: 0.0,
anchorY: 1.0,
x: 150,
y: 2732
}));
menuObjects.push(startButton);
// Add a down event to the startButton
startButton.down = function (x, y, obj) {
// Disable how-to button
howTo.down = null;
loadIntroNarrative();
};
// Retrieve the 'bg_HowTo' asset and position it at the bottom right of the playspace
var howTo = game.addChild(LK.getAsset('bg_HowTo', {
anchorX: 1.0,
anchorY: 1.0,
x: 1950,
y: 2732
}));
menuObjects.push(howTo);
// Variable to track the state of bg_HelpMenu
is_helpMenuVisible = false;
var helpMenu;
// Add a down event to the howTo button
howTo.down = function (x, y, obj) {
if (!is_helpMenuVisible) {
triggerHowToButton();
} else {
// Destroy bg_HelpMenu
if (helpMenu) {
helpMenu.destroy();
}
is_helpMenuVisible = false;
}
// Play s_CrumpledPaper sound
LK.getSound('s_CrumpledPaper').play();
};
}
//a function that will remove all objects from memory when leaving the main menu.
function exitMainMenu() {
is_mainMenu = false;
//destroy all mainMenu objects
for (var i = menuObjects.length - 1; i >= 0; i--) {
if (menuObjects[i]) {
menuObjects[i].destroy();
}
}
//destroy all snowflakes
for (var i = snowflakes.length - 1; i >= 0; i--) {
if (snowflakes[i]) {
snowflakes[i].destroy();
}
}
// Stop all sounds
LK.stopMusic();
// Play shutdownsound
LK.getSound('s_ShutdownSound').play();
// Stop randomSound from playing
timeElapsed = Infinity;
}
//function for the functionnality of the help button
function triggerHowToButton() {
// Instantiate bg_HelpMenu in the center of the playspace
helpMenu = game.addChild(LK.getAsset('bg_HelpMenu', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2 + 150
}));
is_helpMenuVisible = true;
// Ensure bg_Grain and bg_ScanLines are always on the top layer
if (!game.children.includes(grain)) {
game.addChild(grain);
}
game.setChildIndex(grain, game.children.length - 1);
if (!game.children.includes(scanLines)) {
game.addChild(scanLines);
}
game.setChildIndex(scanLines, game.children.length - 1);
}
//function to load the intro narrative
function loadIntroNarrative() {
// Retrieve the 'bg_DarkFilter' asset, position it at the center of the playspace and set its alpha to 0
var darkFilter = game.addChild(LK.getAsset('bg_DarkFilter', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2,
alpha: 0
}));
// Gradually fade in bg_darkfilter
var fadeInterval = LK.setInterval(function () {
darkFilter.alpha += 0.01;
if (darkFilter.alpha >= 1) {
LK.clearInterval(fadeInterval);
}
}, 10);
// Move the destruction of all game elements inside the fadeInterval function
var fadeInterval = LK.setInterval(function () {
darkFilter.alpha += 0.01;
if (darkFilter.alpha >= 1) {
LK.clearInterval(fadeInterval);
// Destroy all game elements including sounds after 1 second
LK.setTimeout(function () {
exitMainMenu();
// Play s_KrampusLaugh01 2 seconds after bg_darkfilter is at 100% alpha only once
if (!this.is_laughPlayed) {
LK.setTimeout(function () {
LK.getSound('s_KrampusLaugh01').play();
// Instantiate bg_Krampus in the center of the playspace
var krampus = game.addChild(LK.getAsset('bg_Krampus', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 3732 / 2 + 700
}));
// Move bg_Krampus to the top layer
game.setChildIndex(krampus, game.children.length - 1);
introObjects.push(krampus);
}, 2000);
this.laughPlayed = true;
}
}, 1000);
}
}, 10);
}
//function to destroy the objects in the introductionscreen
function destroyIntroObj() {
for (var i = introObjects.length - 1; i >= 0; i--) {
if (introObjects[i]) {
introObjects[i].destroy();
}
}
}
//a function to load the first level of the game.
function loadLevel1() {}
//----------------------------------------------------------------------------------------------------
//the update function and the game flow
//----------------------------------------------------------------------------------------------------
//the game update function that looks at the state of the game.
game.update = function () {
// Check the current state of the flicker
if (is_flickerState) {
// If the state is true, set the alpha to 0.5
eyeFlash.alpha = 0.20;
} else {
// If the state is false, set the alpha to 0
eyeFlash.alpha = 0;
}
// Flip the state of the flicker
is_flickerState = !is_flickerState;
// Increment the time elapsed every tick
timeElapsed++;
// Create a new snowflake every 90 ticks only if the main menu is on
if (is_mainMenu) {
// Play either s_manscream01, s_manscream02, s_womanscream01, s_womanscream02 every 10 to 20 seconds
if (timeElapsed % (Math.floor(Math.random() * (1200 - 600 + 1)) + 600) == 0) {
addScream();
}
//have the snowflakes effect
if (LK.ticks % 90 == 0) {
createSnowflake();
}
}
};
Eerie Christmas-inspired toy shop The only text on screen should be the title "Krampus Lockdown" centered on the image.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a single cartoon snowflake. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a simple eerie christmas blank dirty ripped paper. Use christmas colors. Do not put text, just the dirty ripped paper so i can fill it myself with text. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. No text.
A heavily grainy screen filled with analog noise, washed-out colors, subtle scratches on the film, and a worn, nostalgic texture.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
horizontal scan lines, slightly distorted colors, subtle static noise, and faint glow around edges.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
bloody christmas elf glove tapping at screen clipart. Just the glove. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
the number 13 written in black. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
black gothic frame with a question mark inside silhouette. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a simple dirty, dark and eerie Christmas clown key. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
the number 28 written in black, make the numbers eerie. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
the number 7 written in black, make the numbers eerie. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
the number 0 written in black, make the numbers eerie. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Eerie Christmas-inspired room similar to a resident evil room Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Eerie Christmas-inspired bathroom similar to a resident evil room Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a cartoon envelope with an toy elf on it holding a questionmark. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a simple dirty, dark and eerie Christmas bathroom key. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
eerie christmas inspired krampus lock with a resident evil style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
eerie christmas inspired button as an arrow pointing right that says SKIP in a creepy font png. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Eerie Christmas-inspired garage similar to a resident evil room Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a simple fuse inspired from a resident evil puzzle graphics Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
an eerie wall fusebox Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Eerie Christmas-inspired hallway similar to a resident evil room Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
eerie creepy old rusty key with krampus face embossed on it png. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a simple dirty, dark and eerie Christmas bathroom key. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
eerie christmas inspired mistletoe lock with a resident evil style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
eerie christmas inspired tree lock with a resident evil style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a simple dirty, dark and eerie Christmas light key. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
eerie christmas inspired christmas light lock with a resident evil style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
eerie christmas inspired lump of coal with a resident evil style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Eerie flame similar to a resident evil asset, realistic Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Eerie Christmas-inspired krampus statuette similar to a resident evil asset Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a simple eerie christmas blank dirty letter envelope. Use christmas colors. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. No text.
Eerie Christmas-inspired crypt room similar to a resident evil room Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a simple dark red cartoon christmas hat Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. No text.
cartoon mulled wine. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon christmas inspired question mark Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
krampus with a christmas hat coin embossed on it png. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
mulled wine coin embossed on it png. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Eerie Christmas-inspired krampus doll sitting similar to a resident evil Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
old safe png grey with four buttons on the side. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
s_KrampusLaugh01
Sound effect
s_SplashScreen
Sound effect
s_KrampusLaugh02
Sound effect
s_WomanScream01
Sound effect
s_ManScream01
Sound effect
s_ManScream02
Sound effect
s_WomanScream02
Sound effect
s_LightBuzz
Sound effect
s_ShutdownSound
Sound effect
s_CrumpledPaper
Sound effect
s_Bathroom
Sound effect
s_GameOver
Sound effect
s_CartoonRun
Sound effect
s_GetItem
Sound effect
s_KrampusScream
Sound effect
s_UnlockSound
Sound effect
s_WindBlow
Sound effect
s_FuseBoxOn
Sound effect
s_GeneratorSound
Sound effect
s_Locked
Sound effect
s_Interior
Sound effect
s_DollDeath
Sound effect
s_Footsteps
Sound effect
s_DollLaugh01
Sound effect
s_DollLaugh02
Sound effect
s_DollDeath01
Sound effect
s_DollDeath02
Sound effect
s_EncounterMusic
Sound effect
s_FirstDollMusic
Sound effect
s_ChristmasMusic
Sound effect
s_BreakingSound
Sound effect
s_Collected
Sound effect
s_Extinguished
Sound effect
s_Appear
Sound effect
s_MulledWine
Sound effect
s_Slurping
Sound effect
s_SafeUnlocked
Sound effect
s_LockedSafe
Sound effect