User prompt
make it so when the 25% of the gambling machine outputs try again, you lose 90% of your money
User prompt
make a icon when the player buys the anti reject, make it so there's a pickaxe, and there's a circle with a slash through it
User prompt
make it so like at level 20 and beyond, half of the time the cube will reject the swipes, forcing you to gamble to buy or wait patiently and what the anti rejection will do for 1 minute, the cube will not reject the swipes.
User prompt
and when reset is clicked, make the level is level one,
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'visible')' in or related to this line: 'skipLevelButton.visible = false; // Hide skip level button on reset' Line Number: 281
User prompt
delete the skip level boost and delete the skip level button in the shop and in the skip level button
User prompt
make it so whenever the reset button is clicked, its level 1, MindCoins is 0, and the level number is 1, and skip level is hidden
User prompt
make it so that after skip level is pressed, its hidden until level skip is pressed and then its shown
User prompt
Please fix the bug: 'Uncaught ReferenceError: playerGraphics is not defined' in or related to this line: 'playerGraphics.tint = 0x00FF00; // Example glow effect' Line Number: 231
User prompt
still not working
User prompt
can you make the cube when its like lvl 20 and above reject certain swipes and can you make when anti rejection is clicked it removes 25 MC and gives you the power to swipe rejection free (29 seconds), a dream boost which adds a uranium ad and makes you glow and have a trail, and it removes 40 MC (MC means MineCoins) and When Level Skip is CLicked, Remove 75 MC and skip one level.
User prompt
can you make the levels harder and when the game is first played its reset to 1 MindCoins and Level 1 and its on level 1
User prompt
can you make it so when the shop is clicked the maze and cubes are hidden and when its x'ed out, it is shown
User prompt
can you do it
User prompt
Please fix the bug: 'storage.clear is not a function' in or related to this line: 'storage.clear();' Line Number: 261 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
make it so when it is refreshed, all progress is gone
User prompt
Please fix the bug: 'Uncaught ReferenceError: exit is not defined' in or related to this line: 'exit.visible = true;' Line Number: 512
User prompt
make it so when the shop is clicked the maze, cube, and green cube assets are gone
User prompt
lvl 6 is the same make it so all levels have a opening to get to green
User prompt
lvl 5 is impossible, make a opening next to the green cube
Code edit (1 edits merged)
Please save this source code
User prompt
Mind Maze: Cube Gambler
User prompt
make it so you can gamble by clicking the gamble button so you can gamble by 5 mind coins and every 2 seconds u get 1 mind coin and the gambling machine is rigged so there's a 75% chance of hitting it rich
User prompt
make it so when the shop is clicked, it shows the power ups you can buy
Initial prompt
make a maze game and the player is a cube and you have to swipe and its a 1rst person maze game so u have to get to the green side to get to the next level and make like 67 of levels and make it so at level 10, the cube becomes insane and rejects certain swipes and make it so at level 36 it becomes spooky and scary and add it so in later levels (e.g. LVL 12) you can gain Mindcoins (gain one mindcoin per 1 lvl) (Game's version of money) and you can press the shop button to unlock, anti rejection boost (12-15 coins), a dream boost, (20-25 coins, making a dream about uranium) and a skip boost (skips 2 levels, 348 coins)
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { level: 1, coins: 0, antiRejection: 0, dreamBoost: 0, levelSkips: 0 }); /**** * Classes ****/ var Button = Container.expand(function (text, width, height, color) { var self = Container.call(this); var buttonWidth = width || 300; var buttonHeight = height || 100; var buttonColor = color || 0x3498db; var buttonGraphics = self.attachAsset('button', { anchorX: 0.5, anchorY: 0.5, width: buttonWidth, height: buttonHeight, color: buttonColor }); var buttonText = new Text2(text, { size: 50, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.setText = function (newText) { buttonText.setText(newText); }; self.down = function (x, y, obj) { tween(buttonGraphics, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut }); }; self.up = function (x, y, obj) { tween(buttonGraphics, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); }; return self; }); var Coin = Container.expand(function () { var self = Container.call(this); var coinGraphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { coinGraphics.rotation += 0.05; }; return self; }); var Exit = Container.expand(function () { var self = Container.call(this); var exitGraphics = self.attachAsset('exit', { anchorX: 0.5, anchorY: 0.5, alpha: 0.8 }); // Pulsing animation var pulseDirection = 1; var pulseMin = 0.7; var pulseMax = 1.0; self.update = function () { exitGraphics.alpha += 0.01 * pulseDirection; if (exitGraphics.alpha >= pulseMax) { exitGraphics.alpha = pulseMax; pulseDirection = -1; } else if (exitGraphics.alpha <= pulseMin) { exitGraphics.alpha = pulseMin; pulseDirection = 1; } exitGraphics.rotation += 0.02; }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.isMoving = false; self.moveSpeed = 10; self.targetX = 0; self.targetY = 0; self.moveToCell = function (cellX, cellY) { if (self.isMoving) { return false; } // Calculate target position self.targetX = cellX * cellSize + cellSize / 2; self.targetY = cellY * cellSize + cellSize / 2; // If cube has developed a mind of its own (after level 20) and no anti-rejection if (storage.level >= 20 && Math.random() < 0.2 && storage.antiRejection <= 0) { LK.getSound('reject').play(); // Show rejection animation tween(playerGraphics, { rotation: Math.PI * 2 }, { duration: 500, easing: tween.easeInOut }); return false; } if (storage.antiRejection > 0) { storage.antiRejection--; updateShopUI(); } self.isMoving = true; // Animate movement tween(self, { x: self.targetX, y: self.targetY }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { self.isMoving = false; checkCollisions(); } }); LK.getSound('move').play(); return true; }; self.update = function () { // Add subtle idle animation if (!self.isMoving) { playerGraphics.rotation += 0.01; } }; return self; }); var ShopItem = Container.expand(function (name, description, price, count) { var self = Container.call(this); var buttonGraphics = self.attachAsset('shopButton', { anchorX: 0.5, anchorY: 0.5 }); var titleText = new Text2(name, { size: 36, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0); titleText.y = -30; self.addChild(titleText); var descText = new Text2(description, { size: 24, fill: 0xCCCCCC }); descText.anchor.set(0.5, 0); descText.y = 10; self.addChild(descText); var priceText = new Text2(price + " MC", { size: 30, fill: 0xFFCC00 }); priceText.anchor.set(0.5, 0); priceText.y = 40; self.addChild(priceText); var countText = new Text2("Owned: " + count, { size: 24, fill: 0xFFFFFF }); countText.anchor.set(1.0, 0); countText.x = 100; countText.y = -30; self.addChild(countText); self.name = name; self.price = price; self.updateCount = function (newCount) { countText.setText("Owned: " + newCount); }; self.down = function (x, y, obj) { tween(buttonGraphics, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut }); }; self.up = function (x, y, obj) { tween(buttonGraphics, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); // Check if player can afford if (storage.coins >= self.price) { storage.coins -= self.price; if (self.name === "Anti-Rejection") { storage.antiRejection += 29; // 29 seconds of rejection-free swipes } else if (self.name === "Dream Boost") { storage.dreamBoost += 1; // Add uranium ad effect and glow // Implement glow and trail effect player.tint = 0x00FF00; // Example glow effect // Add trail effect logic here } LK.getSound('coin').play(); updateShopUI(); updateCoinsUI(); } }; return self; }); var Wall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('wall', { anchorX: 0.5, anchorY: 0.5 }); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2c3e50 }); /**** * Game Code ****/ // Game variables // Clear storage to reset progress on refresh storage = LK.import('@upit/storage.v1', { level: 1, coins: 0, antiRejection: 0, dreamBoost: 0, levelSkips: 0 }); // Reset MindCoins and Level to 1 when the game is first played if (!storage.hasPlayed) { storage.level = 1; storage.coins = 0; storage.hasPlayed = true; skipLevelButton.visible = false; // Hide skip level button on reset } function resetGame() { storage.level = 1; storage.coins = 0; updateLevelUI(); updateCoinsUI(); skipLevelButton.visible = false; // Hide skip level button on reset } var mazeContainer; var playerContainer; var shopContainer; var isShopOpen = false; var cellSize = 120; var mazeWidth = 0; var mazeHeight = 0; var playerCellX = 0; var playerCellY = 0; var maze = []; var lastSwipeDirection = ''; var lastSwipeTime = 0; var coinTimer = 0; var gameInitialized = false; // UI Elements var coinText; var levelText; var gambleButton; var shopButton; var skipLevelButton; var antiRejectionItem; var dreamBoostItem; var levelSkipItem; // Level data generator function generateMaze(level) { // Maze size increases with level, making it harder var size = Math.min(5 + Math.floor(level / 3), 15); mazeWidth = size; mazeHeight = size; // Initialize maze with all walls maze = []; for (var y = 0; y < mazeHeight; y++) { maze[y] = []; for (var x = 0; x < mazeWidth; x++) { maze[y][x] = 1; // 1 = wall } } // Create paths using a simple algorithm var startX = 1; var startY = 1; var exitX = mazeWidth - 2; var exitY = mazeHeight - 2; maze[startY][startX] = 0; // 0 = path // Simple recursive maze generator function carve(x, y) { var directions = [[0, -2], // Up [2, 0], // Right [0, 2], // Down [-2, 0] // Left ]; // Shuffle directions for (var i = directions.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = directions[i]; directions[i] = directions[j]; directions[j] = temp; } // Try each direction for (var i = 0; i < directions.length; i++) { var dx = directions[i][0]; var dy = directions[i][1]; var nx = x + dx; var ny = y + dy; if (nx > 0 && nx < mazeWidth - 1 && ny > 0 && ny < mazeHeight - 1 && maze[ny][nx] === 1) { // Carve path maze[y + dy / 2][x + dx / 2] = 0; maze[ny][nx] = 0; carve(nx, ny); } } } carve(startX, startY); // Ensure exit is accessible maze[exitY][exitX] = 0; // Create an opening next to the exit for all levels maze[exitY][exitX - 1] = 0; // Open path to the left of the exit // Add more random paths for higher levels to increase difficulty if (level > 10) { var extraPaths = Math.min(Math.floor(level / 5), 10); for (var i = 0; i < extraPaths; i++) { var rx = Math.floor(Math.random() * (mazeWidth - 2)) + 1; var ry = Math.floor(Math.random() * (mazeHeight - 2)) + 1; maze[ry][rx] = 0; } } // Set player start position playerCellX = startX; playerCellY = startY; return { startX: startX, startY: startY, exitX: exitX, exitY: exitY }; } function renderMaze() { // Clear existing maze if any if (mazeContainer) { game.removeChild(mazeContainer); } mazeContainer = new Container(); game.addChild(mazeContainer); // Center the maze on screen var mazePixelWidth = mazeWidth * cellSize; var mazePixelHeight = mazeHeight * cellSize; mazeContainer.x = (2048 - mazePixelWidth) / 2; mazeContainer.y = (2732 - mazePixelHeight) / 2; // Create walls for (var y = 0; y < mazeHeight; y++) { for (var x = 0; x < mazeWidth; x++) { if (maze[y][x] === 1) { var wall = new Wall(); wall.x = x * cellSize + cellSize / 2; wall.y = y * cellSize + cellSize / 2; mazeContainer.addChild(wall); } } } // Add exit exit = new Exit(); exit.x = positions.exitX * cellSize + cellSize / 2; exit.y = positions.exitY * cellSize + cellSize / 2; mazeContainer.addChild(exit); // Add player player = new Player(); player.x = positions.startX * cellSize + cellSize / 2; player.y = positions.startY * cellSize + cellSize / 2; mazeContainer.addChild(player); } function movePlayer(dx, dy) { if (player.isMoving) { return; } var newX = playerCellX + dx; var newY = playerCellY + dy; // Check if valid move if (newX >= 0 && newX < mazeWidth && newY >= 0 && newY < mazeHeight && maze[newY][newX] === 0) { if (player.moveToCell(newX, newY)) { playerCellX = newX; playerCellY = newY; } } } function checkCollisions() { // Check if player reached exit if (playerCellX === positions.exitX && playerCellY === positions.exitY) { // Level completed! LK.getSound('win').play(); // Increase level storage.level++; // Check if level is 67 to reset if (storage.level === 67) { storage.level = 1; storage.coins = 0; storage.hasPlayed = false; // Reset hasPlayed to allow reset on next game start } // Update UI after potential reset updateLevelUI(); // Award bonus coins for completion var bonus = Math.floor(5 + storage.level / 2); storage.coins += bonus; updateCoinsUI(); // Show level complete popup and proceed to next level LK.setTimeout(function () { initLevel(); }, 1000); } } function updateCoinsUI() { coinText.setText("MindCoins: " + storage.coins); } function updateLevelUI() { levelText.setText("Level: " + storage.level); } function updateShopUI() { if (antiRejectionItem) { antiRejectionItem.updateCount(storage.antiRejection); } if (dreamBoostItem) { dreamBoostItem.updateCount(storage.dreamBoost); } if (levelSkipItem) { levelSkipItem.updateCount(storage.levelSkips); } if (skipLevelButton) { skipLevelButton.visible = storage.levelSkips > 0; } } function gamble() { if (storage.coins >= 5) { storage.coins -= 5; updateCoinsUI(); LK.getSound('gamble').play(); // 75% chance to win (rigged in player's favor) if (Math.random() < 0.75) { // Win 15 coins (net profit of 10) var winnings = 15; // Bigger wins on higher levels if (storage.level > 20) { winnings = 20; } // Apply dream boost if owned if (storage.dreamBoost > 0) { storage.dreamBoost--; winnings *= 2; updateShopUI(); } storage.coins += winnings; // Show win animation var winText = new Text2("+" + winnings + "!", { size: 80, fill: 0xFFCC00 }); winText.anchor.set(0.5, 0.5); winText.x = gambleButton.x; winText.y = gambleButton.y - 150; game.addChild(winText); tween(winText, { y: winText.y - 100, alpha: 0 }, { duration: 1000, easing: tween.easeOut, onFinish: function onFinish() { game.removeChild(winText); } }); } else { // Lose animation var loseText = new Text2("Try Again!", { size: 60, fill: 0xFF5555 }); loseText.anchor.set(0.5, 0.5); loseText.x = gambleButton.x; loseText.y = gambleButton.y - 150; game.addChild(loseText); tween(loseText, { y: loseText.y - 100, alpha: 0 }, { duration: 1000, easing: tween.easeOut, onFinish: function onFinish() { game.removeChild(loseText); } }); } updateCoinsUI(); } } function toggleShop() { if (isShopOpen) { // Close shop tween(shopContainer, { alpha: 0 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { shopContainer.visible = false; // Show maze, player, and exit assets mazeContainer.visible = true; player.visible = true; exit.visible = true; } }); } else { // Hide maze, player, and exit assets mazeContainer.visible = false; player.visible = false; exit.visible = false; // Open shop shopContainer.visible = true; tween(shopContainer, { alpha: 1 }, { duration: 300, easing: tween.easeOut }); } isShopOpen = !isShopOpen; } function initUI() { // Create coin counter coinText = new Text2("MindCoins: " + storage.coins, { size: 50, fill: 0xFFCC00 }); coinText.anchor.set(1, 0); LK.gui.topRight.addChild(coinText); // Create level indicator levelText = new Text2("Level: " + storage.level, { size: 50, fill: 0xFFFFFF }); levelText.anchor.set(0, 0); LK.gui.top.addChild(levelText); // Create gamble button gambleButton = new Button("GAMBLE 5 MC", 350, 120, 0xE74C3C); gambleButton.x = 2048 - 200; gambleButton.y = 2732 - 200; game.addChild(gambleButton); gambleButton.up = function () { tween(gambleButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); gamble(); }; // Create shop button shopButton = new Button("SHOP", 200, 100, 0x2ECC71); shopButton.x = 150; shopButton.y = 2732 - 200; game.addChild(shopButton); shopButton.up = function () { tween(shopButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); toggleShop(); }; // Create shop container shopContainer = new Container(); shopContainer.visible = false; shopContainer.alpha = 0; game.addChild(shopContainer); // Shop background var shopBg = LK.getAsset('shopBackground', { anchorX: 0.5, anchorY: 0.5, alpha: 0.9 }); shopBg.x = 2048 / 2; shopBg.y = 2732 / 2; shopContainer.addChild(shopBg); // Shop title var shopTitle = new Text2("MIND MAZE SHOP", { size: 80, fill: 0xFFFFFF }); shopTitle.anchor.set(0.5, 0); shopTitle.x = 2048 / 2; shopTitle.y = 2732 / 2 - 700; shopContainer.addChild(shopTitle); // Shop items antiRejectionItem = new ShopItem("Anti-Rejection", "Prevent 5 move rejections", 25, storage.antiRejection); antiRejectionItem.x = 2048 / 2; antiRejectionItem.y = 2732 / 2 - 400; shopContainer.addChild(antiRejectionItem); dreamBoostItem = new ShopItem("Dream Boost", "Double gamble winnings 3 times", 40, storage.dreamBoost); dreamBoostItem.x = 2048 / 2; dreamBoostItem.y = 2732 / 2 - 200; shopContainer.addChild(dreamBoostItem); // Close shop button var closeButton = new Button("CLOSE", 200, 80, 0xE74C3C); closeButton.x = 2048 / 2; closeButton.y = 2732 / 2 + 200; shopContainer.addChild(closeButton); closeButton.up = function () { tween(closeButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); toggleShop(); }; // Reset button var resetButton = new Button("RESET", 200, 80, 0xE74C3C); resetButton.x = 2048 / 2; resetButton.y = 250; game.addChild(resetButton); resetButton.up = function () { tween(resetButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); resetGame(); }; } function initSwipeControl() { // Handle swipe gestures for movement var startX = 0; var startY = 0; var isTracking = false; game.down = function (x, y) { if (isShopOpen) { return; } startX = x; startY = y; isTracking = true; }; game.up = function (x, y) { if (isShopOpen || !isTracking) { return; } var dx = x - startX; var dy = y - startY; var threshold = 50; // Determine swipe direction if (Math.abs(dx) > Math.abs(dy) && Math.abs(dx) > threshold) { // Horizontal swipe if (dx > 0) { movePlayer(1, 0); // Right lastSwipeDirection = 'right'; } else { movePlayer(-1, 0); // Left lastSwipeDirection = 'left'; } } else if (Math.abs(dy) > Math.abs(dx) && Math.abs(dy) > threshold) { // Vertical swipe if (dy > 0) { movePlayer(0, 1); // Down lastSwipeDirection = 'down'; } else { movePlayer(0, -1); // Up lastSwipeDirection = 'up'; } } lastSwipeTime = Date.now(); isTracking = false; }; } function initLevel() { // Generate new level positions = generateMaze(storage.level); renderMaze(); // Update UI to reflect new level updateLevelUI(); updateShopUI(); } function initGame() { if (gameInitialized) { return; } LK.playMusic('bgmusic'); initUI(); initSwipeControl(); initLevel(); gameInitialized = true; } // Main game loop game.update = function () { if (!gameInitialized) { initGame(); } // Award coins every 2 seconds (120 ticks) if (LK.ticks % 120 === 0) { storage.coins += 1; updateCoinsUI(); } // Check if game is in shop mode if (isShopOpen) { return; // Skip other updates when shop is open } }; // Initialize the game initGame();
===================================================================
--- original.js
+++ change.js
@@ -212,11 +212,8 @@
storage.dreamBoost += 1; // Add uranium ad effect and glow
// Implement glow and trail effect
player.tint = 0x00FF00; // Example glow effect
// Add trail effect logic here
- } else if (self.name === "Level Skip") {
- storage.levelSkips += 1;
- skipLevelButton.visible = true; // Show skip level button when level skip is purchased
}
LK.getSound('coin').play();
updateShopUI();
updateCoinsUI();
@@ -551,20 +548,8 @@
});
}
isShopOpen = !isShopOpen;
}
-function skipLevel() {
- if (storage.levelSkips > 0 && storage.coins >= 75) {
- skipLevelButton.visible = false; // Hide skip level button after use
- storage.levelSkips--;
- storage.coins -= 75; // Deduct 75 MC
- storage.level++;
- updateShopUI();
- updateLevelUI();
- updateCoinsUI();
- initLevel();
- }
-}
function initUI() {
// Create coin counter
coinText = new Text2("MindCoins: " + storage.coins, {
size: 50,
@@ -640,12 +625,8 @@
dreamBoostItem = new ShopItem("Dream Boost", "Double gamble winnings 3 times", 40, storage.dreamBoost);
dreamBoostItem.x = 2048 / 2;
dreamBoostItem.y = 2732 / 2 - 200;
shopContainer.addChild(dreamBoostItem);
- levelSkipItem = new ShopItem("Level Skip", "Skip current level", 75, storage.levelSkips);
- levelSkipItem.x = 2048 / 2;
- levelSkipItem.y = 2732 / 2;
- shopContainer.addChild(levelSkipItem);
// Close shop button
var closeButton = new Button("CLOSE", 200, 80, 0xE74C3C);
closeButton.x = 2048 / 2;
closeButton.y = 2732 / 2 + 200;
@@ -659,24 +640,8 @@
easing: tween.easeOut
});
toggleShop();
};
- // Skip level button (visible only if player has skip tokens)
- skipLevelButton = new Button("SKIP LEVEL", 200, 80, 0xF39C12);
- skipLevelButton.x = 2048 / 2;
- skipLevelButton.y = 150;
- skipLevelButton.visible = storage.levelSkips > 0;
- game.addChild(skipLevelButton);
- skipLevelButton.up = function () {
- tween(skipLevelButton, {
- scaleX: 1.0,
- scaleY: 1.0
- }, {
- duration: 100,
- easing: tween.easeOut
- });
- skipLevel();
- };
// Reset button
var resetButton = new Button("RESET", 200, 80, 0xE74C3C);
resetButton.x = 2048 / 2;
resetButton.y = 250;