Code edit (4 edits merged)
Please save this source code
User prompt
in room2() if !room2state.is_unlocked instantiate bathroomLock at room2State.lockX and room2state.locky
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: tween is not defined' in or related to this line: 'tween(textObject, {' Line Number: 646 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
create a function to retrieve an asset from levelObjs
User prompt
in the update function if is_room2=true get the asset of fuseboxRed
Code edit (1 edits merged)
Please save this source code
Code edit (7 edits merged)
Please save this source code
User prompt
in room2() after the instantiation of fusebox, instantiate bg_fuseboxgreen according to fusebox_greenX and fusebox_greenY property in room2state
Code edit (4 edits merged)
Please save this source code
User prompt
in room2() instantiate fusebox at fuseboxX and fuseboxY property of room2 state
Code edit (1 edits merged)
Please save this source code
Code edit (10 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: stopSoundInterval is not defined' in or related to this line: 'stopSoundInterval();' Line Number: 1487
Code edit (5 edits merged)
Please save this source code
User prompt
in room2() if the property is_key_found == false, instantiate bg_bathroomkey at room2state.keyx and room2dtate.keyy
Code edit (3 edits merged)
Please save this source code
User prompt
use playSoundEveryInterval for playing s_bathroom and the interval should be 10000
User prompt
create a function to stop the playSoundEveryInterval
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
create a function that will play a sound every 10000ms
Code edit (2 edits merged)
Please save this source code
User prompt
stop the bathroom sound when getting in room2()
===================================================================
--- original.js
+++ change.js
@@ -166,9 +166,9 @@
var movementCheckInterval;
var inventoryCoordinateLeftX = 2048 / 2 - 780; //2048 / 2 - 500;
var inventoryCoordY = 2732 - 250;
var inventoryCoordinateRightX = 2048 / 2 - 280; //+ 500;
-var activeLocks = {};
+var collidableObjects = {};
var menuObjects = [];
var howToObjects = [];
var levelObjs = [];
var inventoryUI1;
@@ -183,9 +183,9 @@
var is_flickerState = false;
var is_room2 = false;
var room2State = {
is_unlocked: false,
- is_fusebox_fixed: true,
+ is_fusebox_fixed: false,
is_fuse_found: false,
is_collectible_found: false,
is_key_found: false,
is_safe_unlocked: false,
@@ -204,12 +204,12 @@
arrowLeftX: 200,
arrowLeftY: 2732 / 2,
keyX: 1300,
keyY: 1650,
- fusebox_redX: 600,
- fusebox_redY: 600,
- fusebox_greenX: 400,
- fesebox_greenY: 400
+ fusebox_redX: 650,
+ fusebox_redY: 975,
+ fusebox_greenX: 675,
+ fusebox_greenY: 975
};
var room1State = {
is_unlocked: false,
is_collectible_found: false,
@@ -246,28 +246,28 @@
break;
}
}
}
-function findLock(lockID) {
+function findCollidableObjects(assetID) {
var asset = null;
- if (activeLocks !== null && activeLocks.hasOwnProperty(lockID)) {
- asset = activeLocks[lockID];
+ if (collidableObjects !== null && collidableObjects.hasOwnProperty(assetID)) {
+ asset = collidableObjects[assetID];
}
return asset;
}
-function addLock(lockAsset, lockID) {
- if (!activeLocks.hasOwnProperty(lockID)) {
- activeLocks[lockID] = lockAsset;
+function addCollidableObjects(asset, assetID) {
+ if (!collidableObjects.hasOwnProperty(assetID)) {
+ collidableObjects[assetID] = asset;
return true;
}
return false;
}
-function removeLock(lockID) {
- if (activeLocks !== null && activeLocks.hasOwnProperty(lockID)) {
- var lockAsset = activeLocks[lockID];
- if (lockAsset) {
- lockAsset.destroy(); // Destroy the game object
- delete activeLocks[lockID]; // Remove the property from activeLocks
+function removeCollidableObjects(assetID) {
+ if (collidableObjects !== null && collidableObjects.hasOwnProperty(assetID)) {
+ var asset = collidableObjects[assetID];
+ if (asset) {
+ // asset.destroy(); // Destroy the game object
+ delete collidableObjects[assetID]; // Remove the property from collidableObjects
return true; // Indicate success
}
}
return false; // Indicate failure
@@ -1168,9 +1168,9 @@
// Positioned towards the right side
y: room1State.lockY
});
game.addChild(bathroomLock);
- addLock(bathroomLock, 'bg_BathroomLock');
+ addCollidableObjects(bathroomLock, 'bg_BathroomLock');
// Add event listener for bathroomLock
bathroomLock.down = function (x, y, obj) {
shakeAsset(bathroomLock);
};
@@ -1253,9 +1253,8 @@
is_level1 = false;
}
is_room2 = true;
stopSoundInterval(); // Stop the bathroom sound when entering room2
- //HERE INSTANTIATE STUFF DEPENDING ON THE ROOM2STATE OBJECT PROPERTIES
var fadeOut = LK.getAsset('bg_DarkFilter', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
@@ -1289,24 +1288,10 @@
y: room2State.fuseboxY
});
game.addChild(fusebox);
levelObjs.push(fusebox);
- var fuseboxGreen = LK.getAsset('bg_FuseBoxGreen', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: room2State.fusebox_greenX,
- y: room2State.fusebox_greenY
- });
- game.addChild(fuseboxGreen);
- levelObjs.push(fuseboxGreen);
- var fuseboxRed = LK.getAsset('bg_FuseBoxRed', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: room2State.fusebox_redX,
- y: room2State.fusebox_redY
- });
- game.addChild(fuseboxRed);
- levelObjs.push(fuseboxRed);
+ addCollidableObjects(fusebox, 'bg_FuseBox');
+ //depending on if the fusebox has been fixed or not
// Instantiate ElfEnvelope on the center right of room2
var elfEnvelope = LK.getAsset('bg_ElfEnvelope01', {
anchorX: 0.5,
anchorY: 0.5,
@@ -1317,19 +1302,8 @@
game.addChild(elfEnvelope);
levelObjs.push(elfEnvelope);
// Instantiate bg_FlashLightMask in the center of the playspace
//we only instantiate it if the fusebox is not fixed.
- var flashlightMask = null;
- if (!room2State.is_fusebox_fixed) {
- flashlightMask = LK.getAsset('bg_FlashLightMask', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: room2State.elfX,
- y: room2State.elfY
- });
- game.addChild(flashlightMask);
- levelObjs.push(flashlightMask);
- }
if (!room2State.is_key_found) {
var bathroomKey = LK.getAsset('bg_BathRoomKey', {
anchorX: 0.5,
anchorY: 0.5,
@@ -1345,23 +1319,36 @@
LK.getSound('s_GetItem').play();
}
};
}
- //bring in the arrow left to be able to go back to the bathroom
- // Instantiate arrow left in room 2 with animation and click action to use level1()
- var arrowLeft = LK.getAsset('bg_ArrowLeft', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: room2State.arrowLeftX,
- y: room2State.arrowLeftY
- });
- game.addChild(arrowLeft);
- animateUpDown(arrowLeft, 20, 1000);
- arrowLeft.down = function (x, y, obj) {
- is_room2 = false;
- exitRoom2(levelObjs);
- level1();
- };
+ var flashlightMask = null;
+ if (room2State.is_fusebox_fixed) {
+ var fuseboxGreen = LK.getAsset('bg_FuseBoxGreen', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: room2State.fusebox_greenX,
+ y: room2State.fusebox_greenY
+ });
+ game.addChild(fuseboxGreen);
+ levelObjs.push(fuseboxGreen);
+ } else {
+ var fuseboxRed = LK.getAsset('bg_FuseBoxRed', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: room2State.fusebox_redX,
+ y: room2State.fusebox_redY
+ });
+ game.addChild(fuseboxRed);
+ levelObjs.push(fuseboxRed);
+ // flashlightMask = LK.getAsset('bg_FlashLightMask', {
+ // anchorX: 0.5,
+ // anchorY: 0.5,
+ // x: room2State.elfX,
+ // y: room2State.elfY
+ // });
+ // game.addChild(flashlightMask);
+ // levelObjs.push(flashlightMask);
+ }
var fuse = null;
if (!room2State.is_fuse_found) {
fuse = LK.getAsset('bg_Fuse', {
anchorX: 0.5,
@@ -1380,8 +1367,23 @@
LK.getSound('s_GetItem').play();
}
};
}
+ //bring in the arrow left to be able to go back to the bathroom
+ // Instantiate arrow left in room 2 with animation and click action to use level1()
+ var arrowLeft = LK.getAsset('bg_ArrowLeft', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: room2State.arrowLeftX,
+ y: room2State.arrowLeftY
+ });
+ game.addChild(arrowLeft);
+ animateUpDown(arrowLeft, 20, 1000);
+ arrowLeft.down = function (x, y, obj) {
+ is_room2 = false;
+ exitRoom2(levelObjs);
+ level1();
+ };
levelObjs.push(arrowLeft);
// Bring forward inventory
bringForwardInventory();
// Bring forward the clock
@@ -1403,9 +1405,9 @@
}
function unlockLock(keyAsset, lockAsset, lockAssetName, arrowAssetName, x, y) {
LK.getSound('s_UnlockSound').play();
lockAsset.destroy();
- removeLock(lockAssetName);
+ removeCollidableObjects(lockAssetName);
removeItemFromInventory(keyAsset);
var arrow =
// Instantiate bathroomArrow
bathroomArrow = LK.getAsset(arrowAssetName, {
@@ -1420,14 +1422,25 @@
//the update function and the game flow
//----------------------------------------------------------------------------------------------------
//the game update function that looks at the state of the game.
game.update = function () {
+ // 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();
+ }
+ }
// Check collision between bathroomKeyItem and bathroomLock
//actions to validate if we are in the level 1
if (is_level1) {
//check for collision between the key and the lock.
var bathroomKeyItem = findInInventory("bg_BathroomKeyItem"); // Retrieve bathroomKeyItem from inventory
- var bathroomLock = findLock('bg_BathroomLock'); // Define bathroomLock variable
+ var bathroomLock = findCollidableObjects('bg_BathroomLock'); // Define bathroomLock variable
if (bathroomKeyItem !== null && bathroomLock !== null && !room1State.is_unlocked) {
if (bathroomKeyItem.intersects(bathroomLock)) {
var arrow = unlockLock(bathroomKeyItem, bathroomLock, "bg_BathroomLock", 'bg_ArrowRight', bathroomLock.x, bathroomLock.y);
room1State.is_unlocked = true;
@@ -1443,8 +1456,58 @@
removeItemFromInventory(bathroomKeyItem);
}
}
}
+ //things to keep an eye on if we are in room2
+ if (is_room2) {
+ if (LK.ticks % 90 == 0) {
+ createSnowflake();
+ }
+ if (!room2State.is_unlocked) {
+ //keep an eye on the key and lock
+ var keyItem = findInInventory("bg_BathroomKeyItem"); // Retrieve bathroomKeyItem from inventory
+ var lockItem = findCollidableObjects('bg_BathroomLock'); // Define bathroomLock variable
+ if (keyItem !== null && lockItem !== null) {
+ if (keyItem.intersects(lockItem)) {
+ var arrow = unlockLock(keyItem, lockItem, "bg_BathroomLock", 'bg_ArrowRight', lockItem.x, lockItem.y);
+ room1State.is_unlocked = true;
+ game.addChild(arrow);
+ animateUpDown(arrow, 20, 1000);
+ arrow.down = function (x, y, obj) {
+ stopSoundInterval();
+ room3();
+ arrow.destroy();
+ };
+ bringForwardVCR();
+ // Remove bathroomKeyItem from inventory
+ removeItemFromInventory(keyItem);
+ }
+ }
+ }
+ //if the fusebox is not fixed and the fuse is found, we want to check for collision
+ if (!room2State.is_fusebox_fixed && room2State.is_fuse_found) {
+ var fuseItem = findInInventory("bg_FuseItem");
+ var fuseboxItem = findCollidableObjects("bg_FuseBox");
+ if (fuseItem !== null && fuseboxItem !== null) {
+ if (fuseItem.intersects(fuseboxItem)) {
+ room2State.is_fusebox_fixed = true; //set to true
+ removeCollidableObjects("bg_FuseBox"); //remove the potential collision
+ //remove red light
+ //add green light
+ var fuseboxGreen = LK.getAsset('bg_FuseBoxGreen', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: room2State.fusebox_greenX,
+ y: room2State.fusebox_greenY
+ });
+ game.addChild(fuseboxGreen);
+ levelObjs.push(fuseboxGreen);
+ bringForwardVCR();
+ removeItemFromInventory(fuseItem); // Remove fuse from inventory
+ }
+ }
+ }
+ }
if (is_flickerState) {
// If the state is true, set the alpha to 0.5
eyeFlash.alpha = 0.20;
} else {
@@ -1458,24 +1521,8 @@
// Check if the clock reaches 12:00:00
if (clock.hours === 12 && clock.minutes === 0 && clock.seconds === 0) {
gameOver();
}
- // 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();
- }
- }
- if (is_room2) {
- if (LK.ticks % 90 == 0) {
- createSnowflake();
- }
- }
};
//the game flow starts here
loadMenu();
// Call the vcr function to initialize bg_Grain and bg_ScanLine
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