User prompt
Locker appears even after Danger Room. Also increased danger room appearance further into the game along with shorter warning timers
User prompt
Exit Now is bugged also anxiety meter cannot be seen
User prompt
Add anxiety when inside locker and add green timer for safe exiting before the entity reenters, at max anxiety player loses. Make keycard appearance randomized ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Room is set as 25, when retrying player should go back to Room 1.
User prompt
Cannot pass after all entities have passed
User prompt
Make danger rooms harder ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Timeout.tick error: undefined is not an object (evaluating 'self.timerText.style.fill = 0xff6b35')' in or related to this line: 'self.timerText.style.fill = 0xff6b35;' Line Number: 113
User prompt
Make a new room. Danger Rooms, unlike keycard rooms, a timer is shown and a player has to hide inside a locker for the entity to pass then can exit out and continue ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Now add new types of rooms. Add Keycard rooms in which the player finds a keycard before progressing. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Improve the visuals even more! ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Improve the background even more! ↪💡 Consider importing and using the following plugins: @upit/tween.v1 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Improve visuals further ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the entire screen have sci-fi art. Then refine the background art ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the background procedural sci-fi style on each room press. Add downtime between each press ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make game reset on win.
Code edit (1 edits merged)
Please save this source code
User prompt
Room Runner 100
Initial prompt
Player goes through 100 rooms trying to reach room 100 using one forward arrows. About it no twists
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var CoreOrb = Container.expand(function () { var self = Container.call(this); var orbGlow = self.attachAsset('orbGlow', { anchorX: 0.5, anchorY: 0.5, alpha: 0.2 }); var orb = self.attachAsset('coreOrb', { anchorX: 0.5, anchorY: 0.5, alpha: 0.8 }); self.initialize = function (roomNumber, index) { var seed = roomNumber * 89 + index * 47; // Random position self.x = seed % 1000 / 1000 * 1800 + 124; self.y = seed * 3 % 1000 / 1000 * 2400 + 166; // Random colors var colorIndex = (seed + index * 29) % sciFiColors.length; orb.tint = sciFiColors[colorIndex]; orbGlow.tint = sciFiColors[(colorIndex + 2) % sciFiColors.length]; // Start pulsing animation self.startPulsing(); }; self.startPulsing = function () { var pulseDuration = 1500 + Math.random() * 1000; var targetScale = 0.7 + Math.random() * 0.6; var targetGlowScale = 0.8 + Math.random() * 0.8; tween(orb, { scaleX: targetScale, scaleY: targetScale, alpha: 0.6 + Math.random() * 0.3 }, { duration: pulseDuration, easing: tween.easeInOut, onFinish: function onFinish() { self.startPulsing(); } }); tween(orbGlow, { scaleX: targetGlowScale, scaleY: targetGlowScale, alpha: 0.1 + Math.random() * 0.2, rotation: orbGlow.rotation + Math.PI }, { duration: pulseDuration * 1.2, easing: tween.easeInOut }); }; return self; }); var EnergyGrid = Container.expand(function () { var self = Container.call(this); self.gridLines = []; self.createGrid = function (roomNumber) { // Clear existing grid lines for (var i = 0; i < self.gridLines.length; i++) { self.gridLines[i].destroy(); } self.gridLines = []; var seed = roomNumber * 61; // Create horizontal grid lines var numHorizontal = 6 + roomNumber % 4; for (var i = 0; i < numHorizontal; i++) { var line = self.attachAsset('gridLine', { anchorX: 0.5, anchorY: 0.5, alpha: 0.1 + Math.random() * 0.2 }); line.x = 1024; line.y = (seed + i * 97) % 1000 / 1000 * 2732; line.scaleX = 0.3 + Math.random() * 0.7; var colorIndex = (seed + i * 53) % sciFiColors.length; line.tint = sciFiColors[colorIndex]; self.gridLines.push(line); self.animateGridLine(line, i, true); } // Create vertical grid lines var numVertical = 4 + roomNumber % 3; for (var i = 0; i < numVertical; i++) { var line = self.attachAsset('verticalGridLine', { anchorX: 0.5, anchorY: 0.5, alpha: 0.08 + Math.random() * 0.15 }); line.x = (seed + i * 113) % 1000 / 1000 * 2048; line.y = 1366; line.scaleY = 0.4 + Math.random() * 0.6; var colorIndex = (seed + i * 71) % sciFiColors.length; line.tint = sciFiColors[colorIndex]; self.gridLines.push(line); self.animateGridLine(line, i, false); } }; self.animateGridLine = function (line, index, isHorizontal) { var duration = 5000 + index * 300; var targetAlpha = 0.05 + Math.random() * 0.25; var targetScale = 0.2 + Math.random() * 0.8; var tweenProps = { alpha: targetAlpha }; if (isHorizontal) { tweenProps.scaleX = targetScale; } else { tweenProps.scaleY = targetScale; } tween(line, tweenProps, { duration: duration, easing: tween.easeInOut, onFinish: function onFinish() { self.animateGridLine(line, index, isHorizontal); } }); }; return self; }); var ForwardButton = Container.expand(function () { var self = Container.call(this); var buttonBackground = self.attachAsset('forwardArrow', { anchorX: 0.5, anchorY: 0.5 }); var arrow = self.attachAsset('arrowTriangle', { anchorX: 0.5, anchorY: 0.5, rotation: Math.PI / 2 }); self.down = function (x, y, obj) { tween(self, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100 }); // Add glow effect on press tween(buttonBackground, { tint: 0x74b9ff }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(buttonBackground, { tint: 0x4a90e2 }, { duration: 300, easing: tween.easeIn }); } }); LK.getSound('roomAdvance').play(); advanceRoom(); }; self.up = function (x, y, obj) { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 100 }); }; return self; }); var GlowEffect = Container.expand(function () { var self = Container.call(this); self.glows = []; self.createGlows = function (roomNumber) { // Clear existing glows for (var i = 0; i < self.glows.length; i++) { self.glows[i].destroy(); } self.glows = []; var seed = roomNumber * 41; var numGlows = 3 + roomNumber % 4; for (var i = 0; i < numGlows; i++) { var glow = self.attachAsset('glow', { anchorX: 0.5, anchorY: 0.5, alpha: 0.1 + Math.random() * 0.15 }); // Position glows glow.x = (seed + i * 137) % 1000 / 1000 * 2048; glow.y = (seed + i * 193) % 1000 / 1000 * 2732; // Color variation var colorIndex = (seed + i * 67) % sciFiColors.length; glow.tint = sciFiColors[colorIndex]; // Random scale var scale = 0.3 + Math.random() * 0.7; glow.scaleX = scale; glow.scaleY = scale; self.glows.push(glow); self.animateGlow(glow, i); } }; self.animateGlow = function (glow, index) { var duration = 4000 + index * 500; var targetScale = 0.2 + Math.random() * 0.8; var targetAlpha = 0.05 + Math.random() * 0.2; tween(glow, { scaleX: targetScale, scaleY: targetScale, alpha: targetAlpha, rotation: glow.rotation + Math.PI }, { duration: duration, easing: tween.easeInOut, onFinish: function onFinish() { self.animateGlow(glow, index); } }); }; return self; }); var ParticleSystem = Container.expand(function () { var self = Container.call(this); self.particles = []; self.createParticles = function (count, roomNumber) { // Clear existing particles for (var i = 0; i < self.particles.length; i++) { self.particles[i].destroy(); } self.particles = []; var seed = roomNumber * 23; for (var i = 0; i < count; i++) { var particle = self.attachAsset('particle', { anchorX: 0.5, anchorY: 0.5, alpha: 0.6 + Math.random() * 0.4 }); // Random position particle.x = Math.random() * 2048; particle.y = Math.random() * 2732; // Random color from sci-fi palette var colorIndex = (seed + i * 31) % sciFiColors.length; particle.tint = sciFiColors[colorIndex]; // Random scale var scale = 0.5 + Math.random() * 1.5; particle.scaleX = scale; particle.scaleY = scale; self.particles.push(particle); self.animateParticle(particle, i); } }; self.animateParticle = function (particle, index) { var duration = 2000 + Math.random() * 3000; var targetX = Math.random() * 2048; var targetY = Math.random() * 2732; var targetAlpha = 0.2 + Math.random() * 0.6; tween(particle, { x: targetX, y: targetY, alpha: targetAlpha, rotation: particle.rotation + Math.PI * 2 }, { duration: duration, easing: tween.easeInOut, onFinish: function onFinish() { self.animateParticle(particle, index); } }); }; return self; }); var RoomDisplay = Container.expand(function () { var self = Container.call(this); var background = self.attachAsset('roomBackground', { anchorX: 0.5, anchorY: 0.5 }); self.updateRoom = function (roomNumber) { // Simple visual feedback for room change tween(self, { alpha: 0.7 }, { duration: 150, onFinish: function onFinish() { tween(self, { alpha: 1 }, { duration: 150 }); } }); }; return self; }); var SciFiBackground = Container.expand(function () { var self = Container.call(this); self.shapes = []; self.createBackground = function (roomNumber) { // Clear existing shapes for (var i = 0; i < self.shapes.length; i++) { self.shapes[i].destroy(); } self.shapes = []; // Create multiple geometric shapes based on room number var seed = roomNumber * 17; // Deterministic but varied var numShapes = 8 + roomNumber % 6; for (var i = 0; i < numShapes; i++) { var shapeType = (seed + i) % 5; var shape; switch (shapeType) { case 0: shape = self.attachAsset('sciFiCircle', { anchorX: 0.5, anchorY: 0.5, alpha: 0.3 + Math.random() * 0.4 }); break; case 1: shape = self.attachAsset('sciFiSmallCircle', { anchorX: 0.5, anchorY: 0.5, alpha: 0.2 + Math.random() * 0.3 }); break; case 2: shape = self.attachAsset('sciFiRect', { anchorX: 0.5, anchorY: 0.5, alpha: 0.25 + Math.random() * 0.35 }); break; case 3: shape = self.attachAsset('sciFiSmallRect', { anchorX: 0.5, anchorY: 0.5, alpha: 0.3 + Math.random() * 0.4 }); break; case 4: shape = self.attachAsset('sciFiLargeRect', { anchorX: 0.5, anchorY: 0.5, alpha: 0.2 + Math.random() * 0.3 }); break; } // Position shapes randomly but deterministically var posX = (seed + i * 73) % 1000 / 1000 * 1800 + 124; var posY = (seed + i * 127) % 1000 / 1000 * 2400 + 166; shape.x = posX; shape.y = posY; shape.rotation = (seed + i * 91) % 360 * Math.PI / 180; // Color variation var colorIndex = (seed + i * 43) % sciFiColors.length; shape.tint = sciFiColors[colorIndex]; self.shapes.push(shape); // Animate shapes self.animateShape(shape, i); } }; self.animateShape = function (shape, index) { var duration = 3000 + index * 200; var scale = 0.8 + Math.random() * 0.4; var targetX = shape.x + (Math.random() - 0.5) * 200; var targetY = shape.y + (Math.random() - 0.5) * 200; // Keep shapes within bounds targetX = Math.max(100, Math.min(1948, targetX)); targetY = Math.max(100, Math.min(2632, targetY)); tween(shape, { scaleX: scale, scaleY: scale, rotation: shape.rotation + Math.PI * 2, x: targetX, y: targetY, alpha: 0.2 + Math.random() * 0.4 }, { duration: duration, easing: tween.easeInOut, onFinish: function onFinish() { self.animateShape(shape, index); } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x0a0a2e }); /**** * Game Code ****/ // Game state variables var currentRoom = storage.currentRoom || 1; var maxRoom = 100; var isAdvancing = false; // Sci-fi color palette for procedural backgrounds var sciFiColors = [0x0a0a2e, 0x16213e, 0x0f3460, 0x533483, 0x7209b7, 0x2d1b69, 0x11998e, 0x38817a, 0x4a90e2, 0x6c5ce7, 0x74b9ff, 0x00b894, 0xa29bfe, 0xfd79a8, 0xfdcb6e, 0xe17055, 0x00cec9, 0x55a3ff, 0x5f27cd, 0x341f97]; // Function to get procedural background color based on room number function getSciFiBackgroundColor(roomNum) { // Use room number to create deterministic but varied color selection var baseIndex = (roomNum - 1) % sciFiColors.length; var variation = Math.floor((roomNum - 1) / sciFiColors.length) % 3; var colorIndex = (baseIndex + variation) % sciFiColors.length; return sciFiColors[colorIndex]; } // Create energy grid (background layer) var energyGrid = game.addChild(new EnergyGrid()); energyGrid.createGrid(currentRoom); // Create glow effects (background layer) var glowEffect = game.addChild(new GlowEffect()); glowEffect.createGlows(currentRoom); // Create sci-fi background var sciFiBackground = game.addChild(new SciFiBackground()); sciFiBackground.createBackground(currentRoom); // Create core orbs (mid layer) var coreOrbs = []; var numOrbs = 3 + currentRoom % 3; for (var i = 0; i < numOrbs; i++) { var orb = game.addChild(new CoreOrb()); orb.initialize(currentRoom, i); coreOrbs.push(orb); } // Create particle system (foreground layer) var particleSystem = game.addChild(new ParticleSystem()); particleSystem.createParticles(15 + currentRoom % 10, currentRoom); // Create room display var roomDisplay = game.addChild(new RoomDisplay()); roomDisplay.x = 2048 / 2; roomDisplay.y = 2732 / 2 - 200; // Set initial sci-fi background color var initialBackgroundColor = getSciFiBackgroundColor(currentRoom); roomDisplay.children[0].tint = initialBackgroundColor; // Create forward button var forwardButton = game.addChild(new ForwardButton()); forwardButton.x = 2048 / 2; forwardButton.y = 2732 / 2 + 300; // Create room counter text var roomCounterText = new Text2('Room ' + currentRoom + '/' + maxRoom, { size: 120, fill: 0x333333 }); roomCounterText.anchor.set(0.5, 0.5); roomCounterText.x = 2048 / 2; roomCounterText.y = 2732 / 2 - 100; game.addChild(roomCounterText); // Create title text var titleText = new Text2('Room Runner 100', { size: 80, fill: 0x666666 }); titleText.anchor.set(0.5, 0); LK.gui.top.addChild(titleText); titleText.y = 150; // Function to advance to next room function advanceRoom() { if (currentRoom < maxRoom && !isAdvancing) { isAdvancing = true; forwardButton.visible = false; // Hide button during transition currentRoom++; storage.currentRoom = currentRoom; // Update room counter roomCounterText.setText('Room ' + currentRoom + '/' + maxRoom); // Get new sci-fi background color var newBackgroundColor = getSciFiBackgroundColor(currentRoom); // Animate background color change tween(roomDisplay.children[0], { tint: newBackgroundColor }, { duration: 800, easing: tween.easeInOut }); // Update particle system particleSystem.createParticles(15 + currentRoom % 10, currentRoom); // Update energy grid energyGrid.createGrid(currentRoom); // Update glow effects glowEffect.createGlows(currentRoom); // Update core orbs for (var i = 0; i < coreOrbs.length; i++) { coreOrbs[i].destroy(); } coreOrbs = []; var numOrbs = 3 + currentRoom % 3; for (var i = 0; i < numOrbs; i++) { var orb = game.addChild(new CoreOrb()); orb.initialize(currentRoom, i); coreOrbs.push(orb); } // Update sci-fi background with fade transition tween(sciFiBackground, { alpha: 0 }, { duration: 400, easing: tween.easeInOut, onFinish: function onFinish() { sciFiBackground.createBackground(currentRoom); tween(sciFiBackground, { alpha: 1 }, { duration: 400, easing: tween.easeInOut }); } }); // Update room display roomDisplay.updateRoom(currentRoom); // Add downtime before allowing next press LK.setTimeout(function () { isAdvancing = false; if (currentRoom < maxRoom) { forwardButton.visible = true; // Show button again } }, 1200); // 1.2 second downtime // Check for completion if (currentRoom >= maxRoom) { LK.setTimeout(function () { // Reset game state before showing win storage.currentRoom = 1; currentRoom = 1; LK.showYouWin(); }, 500); } } } // Hide forward button if game is complete if (currentRoom >= maxRoom) { forwardButton.visible = false; roomCounterText.setText('Complete!'); // Auto-trigger win after short delay LK.setTimeout(function () { // Reset game state before showing win storage.currentRoom = 1; currentRoom = 1; LK.showYouWin(); }, 1000); } game.update = function () { // Simple idle animation for the forward button if (LK.ticks % 120 == 0 && currentRoom < maxRoom) { tween(forwardButton, { scaleX: 1.05, scaleY: 1.05 }, { duration: 300, easing: tween.easeInOut, onFinish: function onFinish() { tween(forwardButton, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.easeInOut }); } }); } };
===================================================================
--- original.js
+++ change.js
@@ -6,8 +6,124 @@
/****
* Classes
****/
+var CoreOrb = Container.expand(function () {
+ var self = Container.call(this);
+ var orbGlow = self.attachAsset('orbGlow', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.2
+ });
+ var orb = self.attachAsset('coreOrb', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.8
+ });
+ self.initialize = function (roomNumber, index) {
+ var seed = roomNumber * 89 + index * 47;
+ // Random position
+ self.x = seed % 1000 / 1000 * 1800 + 124;
+ self.y = seed * 3 % 1000 / 1000 * 2400 + 166;
+ // Random colors
+ var colorIndex = (seed + index * 29) % sciFiColors.length;
+ orb.tint = sciFiColors[colorIndex];
+ orbGlow.tint = sciFiColors[(colorIndex + 2) % sciFiColors.length];
+ // Start pulsing animation
+ self.startPulsing();
+ };
+ self.startPulsing = function () {
+ var pulseDuration = 1500 + Math.random() * 1000;
+ var targetScale = 0.7 + Math.random() * 0.6;
+ var targetGlowScale = 0.8 + Math.random() * 0.8;
+ tween(orb, {
+ scaleX: targetScale,
+ scaleY: targetScale,
+ alpha: 0.6 + Math.random() * 0.3
+ }, {
+ duration: pulseDuration,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ self.startPulsing();
+ }
+ });
+ tween(orbGlow, {
+ scaleX: targetGlowScale,
+ scaleY: targetGlowScale,
+ alpha: 0.1 + Math.random() * 0.2,
+ rotation: orbGlow.rotation + Math.PI
+ }, {
+ duration: pulseDuration * 1.2,
+ easing: tween.easeInOut
+ });
+ };
+ return self;
+});
+var EnergyGrid = Container.expand(function () {
+ var self = Container.call(this);
+ self.gridLines = [];
+ self.createGrid = function (roomNumber) {
+ // Clear existing grid lines
+ for (var i = 0; i < self.gridLines.length; i++) {
+ self.gridLines[i].destroy();
+ }
+ self.gridLines = [];
+ var seed = roomNumber * 61;
+ // Create horizontal grid lines
+ var numHorizontal = 6 + roomNumber % 4;
+ for (var i = 0; i < numHorizontal; i++) {
+ var line = self.attachAsset('gridLine', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.1 + Math.random() * 0.2
+ });
+ line.x = 1024;
+ line.y = (seed + i * 97) % 1000 / 1000 * 2732;
+ line.scaleX = 0.3 + Math.random() * 0.7;
+ var colorIndex = (seed + i * 53) % sciFiColors.length;
+ line.tint = sciFiColors[colorIndex];
+ self.gridLines.push(line);
+ self.animateGridLine(line, i, true);
+ }
+ // Create vertical grid lines
+ var numVertical = 4 + roomNumber % 3;
+ for (var i = 0; i < numVertical; i++) {
+ var line = self.attachAsset('verticalGridLine', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.08 + Math.random() * 0.15
+ });
+ line.x = (seed + i * 113) % 1000 / 1000 * 2048;
+ line.y = 1366;
+ line.scaleY = 0.4 + Math.random() * 0.6;
+ var colorIndex = (seed + i * 71) % sciFiColors.length;
+ line.tint = sciFiColors[colorIndex];
+ self.gridLines.push(line);
+ self.animateGridLine(line, i, false);
+ }
+ };
+ self.animateGridLine = function (line, index, isHorizontal) {
+ var duration = 5000 + index * 300;
+ var targetAlpha = 0.05 + Math.random() * 0.25;
+ var targetScale = 0.2 + Math.random() * 0.8;
+ var tweenProps = {
+ alpha: targetAlpha
+ };
+ if (isHorizontal) {
+ tweenProps.scaleX = targetScale;
+ } else {
+ tweenProps.scaleY = targetScale;
+ }
+ tween(line, tweenProps, {
+ duration: duration,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ self.animateGridLine(line, index, isHorizontal);
+ }
+ });
+ };
+ return self;
+});
var ForwardButton = Container.expand(function () {
var self = Container.call(this);
var buttonBackground = self.attachAsset('forwardArrow', {
anchorX: 0.5,
@@ -291,14 +407,25 @@
var variation = Math.floor((roomNum - 1) / sciFiColors.length) % 3;
var colorIndex = (baseIndex + variation) % sciFiColors.length;
return sciFiColors[colorIndex];
}
+// Create energy grid (background layer)
+var energyGrid = game.addChild(new EnergyGrid());
+energyGrid.createGrid(currentRoom);
// Create glow effects (background layer)
var glowEffect = game.addChild(new GlowEffect());
glowEffect.createGlows(currentRoom);
// Create sci-fi background
var sciFiBackground = game.addChild(new SciFiBackground());
sciFiBackground.createBackground(currentRoom);
+// Create core orbs (mid layer)
+var coreOrbs = [];
+var numOrbs = 3 + currentRoom % 3;
+for (var i = 0; i < numOrbs; i++) {
+ var orb = game.addChild(new CoreOrb());
+ orb.initialize(currentRoom, i);
+ coreOrbs.push(orb);
+}
// Create particle system (foreground layer)
var particleSystem = game.addChild(new ParticleSystem());
particleSystem.createParticles(15 + currentRoom % 10, currentRoom);
// Create room display
@@ -348,10 +475,23 @@
easing: tween.easeInOut
});
// Update particle system
particleSystem.createParticles(15 + currentRoom % 10, currentRoom);
+ // Update energy grid
+ energyGrid.createGrid(currentRoom);
// Update glow effects
glowEffect.createGlows(currentRoom);
+ // Update core orbs
+ for (var i = 0; i < coreOrbs.length; i++) {
+ coreOrbs[i].destroy();
+ }
+ coreOrbs = [];
+ var numOrbs = 3 + currentRoom % 3;
+ for (var i = 0; i < numOrbs; i++) {
+ var orb = game.addChild(new CoreOrb());
+ orb.initialize(currentRoom, i);
+ coreOrbs.push(orb);
+ }
// Update sci-fi background with fade transition
tween(sciFiBackground, {
alpha: 0
}, {