User prompt
Add a next page button for owner commands
User prompt
Add a gem shop βͺπ‘ Consider importing and using the following plugins: @upit/storage.v1
User prompt
Fix it
User prompt
Add a daily shop βͺπ‘ Consider importing and using the following plugins: @upit/storage.v1
User prompt
Add 10 more stuff to the shop βͺπ‘ Consider importing and using the following plugins: @upit/storage.v1
User prompt
Add a shop βͺπ‘ Consider importing and using the following plugins: @upit/storage.v1
User prompt
Add 13 owner commands
User prompt
Add 13 more owner commands
User prompt
Make owner commands on top
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'for (var x = 0; x <= level.length + 1000; x += 200) {' Line Number: 1501
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'if (levelData[currentLevel].shipMode) {' Line Number: 1482
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'if (levelData[currentLevel].shipMode) {' Line Number: 1484
User prompt
Add daily level βͺπ‘ Consider importing and using the following plugins: @upit/storage.v1
User prompt
Add 17 more levels in the next page
User prompt
Make level 51 start with a swing βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ad coins for each level βͺπ‘ Consider importing and using the following plugins: @upit/storage.v1
User prompt
Add a swing βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the video so people know how to beat it
User prompt
Add a video button
User prompt
Make all levels different from each level
User prompt
Add owner commands button
User prompt
Make the speed more faster
User prompt
Make level 1 start with a ship
Code edit (1 edits merged)
Please save this source code
User prompt
Geometry Dash: 50 Level Challenge
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Checkpoint = Container.expand(function (x, y) { var self = Container.call(this); var checkpointGraphics = self.attachAsset('checkpoint', { anchorX: 0.5, anchorY: 1.0 }); self.x = x; self.y = y; self.activated = false; return self; }); var Ground = Container.expand(function (x, y, width) { var self = Container.call(this); var groundGraphics = self.attachAsset('ground', { anchorX: 0, anchorY: 0 }); groundGraphics.width = width || 200; self.x = x; self.y = y; return self; }); var LevelButton = Container.expand(function (levelNum, x, y) { var self = Container.call(this); var buttonGraphics = self.attachAsset('levelButton', { anchorX: 0.5, anchorY: 0.5 }); self.levelNum = levelNum; self.x = x; self.y = y; self.locked = levelNum > 1 && !storage.completedLevels[levelNum - 1]; // Set button color based on status if (self.locked) { buttonGraphics.tint = 0x666666; } else if (storage.completedLevels[levelNum]) { buttonGraphics.tint = 0x00ff00; } // Level number text self.levelText = new Text2(levelNum.toString(), { size: 40, fill: 0xFFFFFF }); self.levelText.anchor.set(0.5, 0.5); self.addChild(self.levelText); self.down = function (x, y, obj) { if (!self.locked) { currentLevel = self.levelNum; showGameplay(); } }; return self; }); var Platform = Container.expand(function (x, y, width) { var self = Container.call(this); var platformGraphics = self.attachAsset('platform', { anchorX: 0, anchorY: 0 }); platformGraphics.width = width || 200; self.x = x; self.y = y; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 1.0 }); self.velocityY = 0; self.isGrounded = false; self.isDead = false; self.jump = function () { if (self.isGrounded && !self.isDead) { self.velocityY = -18; self.isGrounded = false; LK.getSound('jump').play(); } }; self.update = function () { if (self.isDead) return; // Apply gravity self.velocityY += 1.2; self.y += self.velocityY; // Ground collision if (self.y >= groundLevel) { self.y = groundLevel; self.velocityY = 0; self.isGrounded = true; } }; return self; }); var Spike = Container.expand(function (x, y) { var self = Container.call(this); var spikeGraphics = self.attachAsset('spike', { anchorX: 0.5, anchorY: 1.0 }); self.x = x; self.y = y; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222222 }); /**** * Game Code ****/ // Game states var gameState = 'menu'; // 'menu' or 'playing' var currentLevel = 1; var maxLevels = 50; var groundLevel = 2400; var cameraX = 0; var scrollSpeed = 5; // Player variables var player; var playerStartX = 300; var playerStartY = groundLevel; // Level data var obstacles = []; var platforms = []; var grounds = []; var checkpoints = []; var currentCheckpoint = 0; var levelData = {}; // UI elements var levelButtons = []; var backButton; var levelCompleteText; var deathCount = 0; // Storage initialization if (!storage.completedLevels) { storage.completedLevels = {}; } if (!storage.currentLevel) { storage.currentLevel = 1; } // Initialize level data (simplified patterns) function initializeLevelData() { for (var i = 1; i <= maxLevels; i++) { levelData[i] = { spikes: [], platforms: [], checkpoints: [], length: 3000 + i * 200 // Levels get longer }; // Generate simple spike patterns var spikeCount = 5 + Math.floor(i / 2); for (var j = 0; j < spikeCount; j++) { var spikeX = 800 + j * (200 + i * 10); levelData[i].spikes.push({ x: spikeX, y: groundLevel }); } // Add checkpoints every 1000 pixels var checkpointCount = Math.floor(levelData[i].length / 1000); for (var k = 1; k <= checkpointCount; k++) { levelData[i].checkpoints.push({ x: k * 1000, y: groundLevel }); } // Add some platforms for variety if (i > 5) { var platformCount = Math.floor(i / 5); for (var p = 0; p < platformCount; p++) { var platformX = 1200 + p * 400; var platformY = groundLevel - 150 - p % 2 * 100; levelData[i].platforms.push({ x: platformX, y: platformY, width: 200 }); } } } } // UI Setup function setupUI() { // Score display var scoreText = new Text2('Level: ' + currentLevel, { size: 60, fill: 0xFFFFFF }); scoreText.anchor.set(0, 0); scoreText.x = 120; scoreText.y = 50; LK.gui.topLeft.addChild(scoreText); } // Level selection menu function showLevelMenu() { gameState = 'menu'; game.removeChildren(); levelButtons = []; // Title var titleText = new Text2('Geometry Dash: 50 Levels', { size: 80, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0); titleText.x = 1024; titleText.y = 200; game.addChild(titleText); // Create level buttons in grid var buttonsPerRow = 5; var buttonSpacing = 220; var startX = 1024 - (buttonsPerRow - 1) * buttonSpacing / 2; var startY = 400; for (var i = 1; i <= maxLevels; i++) { var row = Math.floor((i - 1) / buttonsPerRow); var col = (i - 1) % buttonsPerRow; var buttonX = startX + col * buttonSpacing; var buttonY = startY + row * 150; var levelBtn = game.addChild(new LevelButton(i, buttonX, buttonY)); levelButtons.push(levelBtn); } } // Show gameplay function showGameplay() { gameState = 'playing'; game.removeChildren(); // Reset camera cameraX = 0; currentCheckpoint = 0; deathCount = 0; // Create player player = game.addChild(new Player()); player.x = playerStartX; player.y = playerStartY; // Load current level loadLevel(currentLevel); } // Load level obstacles function loadLevel(levelNum) { obstacles = []; platforms = []; grounds = []; checkpoints = []; var level = levelData[levelNum]; // Create ground segments for (var x = 0; x <= level.length + 1000; x += 200) { var ground = game.addChild(new Ground(x, groundLevel, 200)); grounds.push(ground); } // Create spikes for (var i = 0; i < level.spikes.length; i++) { var spikeData = level.spikes[i]; var spike = game.addChild(new Spike(spikeData.x, spikeData.y)); obstacles.push(spike); } // Create platforms for (var j = 0; j < level.platforms.length; j++) { var platformData = level.platforms[j]; var platform = game.addChild(new Platform(platformData.x, platformData.y, platformData.width)); platforms.push(platform); } // Create checkpoints for (var k = 0; k < level.checkpoints.length; k++) { var checkpointData = level.checkpoints[k]; var checkpoint = game.addChild(new Checkpoint(checkpointData.x, checkpointData.y)); checkpoints.push(checkpoint); } } // Handle player death function handlePlayerDeath() { if (player.isDead) return; player.isDead = true; deathCount++; LK.effects.flashScreen(0xff0000, 500); LK.getSound('death').play(); // Respawn after delay LK.setTimeout(function () { respawnPlayer(); }, 1000); } // Respawn player at checkpoint function respawnPlayer() { player.isDead = false; player.velocityY = 0; player.isGrounded = false; if (currentCheckpoint > 0 && checkpoints[currentCheckpoint - 1]) { player.x = checkpoints[currentCheckpoint - 1].x; cameraX = checkpoints[currentCheckpoint - 1].x - 400; } else { player.x = playerStartX; cameraX = 0; } player.y = groundLevel; } // Handle level completion function completeLevel() { storage.completedLevels[currentLevel] = true; LK.getSound('complete').play(); LK.effects.flashScreen(0x00ff00, 1000); // Show completion message var completeText = new Text2('Level Complete!', { size: 100, fill: 0x00FF00 }); completeText.anchor.set(0.5, 0.5); completeText.x = 1024; completeText.y = 1366; game.addChild(completeText); // Return to menu after delay LK.setTimeout(function () { showLevelMenu(); }, 2000); } // Input handling game.down = function (x, y, obj) { if (gameState === 'playing' && player && !player.isDead) { player.jump(); } }; // Main game loop game.update = function () { if (gameState !== 'playing' || !player || player.isDead) return; // Auto-scroll camera cameraX += scrollSpeed; player.x += scrollSpeed; // Update camera position var targetCameraX = player.x - 400; if (targetCameraX > cameraX) { cameraX = targetCameraX; } // Position all game objects relative to camera game.x = -cameraX; // Check obstacle collisions for (var i = 0; i < obstacles.length; i++) { var obstacle = obstacles[i]; if (player.intersects(obstacle)) { handlePlayerDeath(); break; } } // Check platform collisions (simple top collision) for (var j = 0; j < platforms.length; j++) { var platform = platforms[j]; if (player.intersects(platform) && player.velocityY > 0) { var playerBottom = player.y; var platformTop = platform.y; if (playerBottom >= platformTop && playerBottom <= platformTop + 20) { player.y = platformTop; player.velocityY = 0; player.isGrounded = true; } } } // Check checkpoint activation for (var k = 0; k < checkpoints.length; k++) { var checkpoint = checkpoints[k]; if (!checkpoint.activated && player.intersects(checkpoint)) { checkpoint.activated = true; currentCheckpoint = k + 1; LK.effects.flashObject(checkpoint, 0x00ffff, 500); } } // Check level completion var levelLength = levelData[currentLevel].length; if (player.x >= levelLength) { completeLevel(); } // Check if player fell off screen if (player.y > 2800) { handlePlayerDeath(); } }; // Initialize game initializeLevelData(); setupUI(); showLevelMenu();
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,389 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1");
+
+/****
+* Classes
+****/
+var Checkpoint = Container.expand(function (x, y) {
+ var self = Container.call(this);
+ var checkpointGraphics = self.attachAsset('checkpoint', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ self.x = x;
+ self.y = y;
+ self.activated = false;
+ return self;
+});
+var Ground = Container.expand(function (x, y, width) {
+ var self = Container.call(this);
+ var groundGraphics = self.attachAsset('ground', {
+ anchorX: 0,
+ anchorY: 0
+ });
+ groundGraphics.width = width || 200;
+ self.x = x;
+ self.y = y;
+ return self;
+});
+var LevelButton = Container.expand(function (levelNum, x, y) {
+ var self = Container.call(this);
+ var buttonGraphics = self.attachAsset('levelButton', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.levelNum = levelNum;
+ self.x = x;
+ self.y = y;
+ self.locked = levelNum > 1 && !storage.completedLevels[levelNum - 1];
+ // Set button color based on status
+ if (self.locked) {
+ buttonGraphics.tint = 0x666666;
+ } else if (storage.completedLevels[levelNum]) {
+ buttonGraphics.tint = 0x00ff00;
+ }
+ // Level number text
+ self.levelText = new Text2(levelNum.toString(), {
+ size: 40,
+ fill: 0xFFFFFF
+ });
+ self.levelText.anchor.set(0.5, 0.5);
+ self.addChild(self.levelText);
+ self.down = function (x, y, obj) {
+ if (!self.locked) {
+ currentLevel = self.levelNum;
+ showGameplay();
+ }
+ };
+ return self;
+});
+var Platform = Container.expand(function (x, y, width) {
+ var self = Container.call(this);
+ var platformGraphics = self.attachAsset('platform', {
+ anchorX: 0,
+ anchorY: 0
+ });
+ platformGraphics.width = width || 200;
+ self.x = x;
+ self.y = y;
+ return self;
+});
+var Player = Container.expand(function () {
+ var self = Container.call(this);
+ var playerGraphics = self.attachAsset('player', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ self.velocityY = 0;
+ self.isGrounded = false;
+ self.isDead = false;
+ self.jump = function () {
+ if (self.isGrounded && !self.isDead) {
+ self.velocityY = -18;
+ self.isGrounded = false;
+ LK.getSound('jump').play();
+ }
+ };
+ self.update = function () {
+ if (self.isDead) return;
+ // Apply gravity
+ self.velocityY += 1.2;
+ self.y += self.velocityY;
+ // Ground collision
+ if (self.y >= groundLevel) {
+ self.y = groundLevel;
+ self.velocityY = 0;
+ self.isGrounded = true;
+ }
+ };
+ return self;
+});
+var Spike = Container.expand(function (x, y) {
+ var self = Container.call(this);
+ var spikeGraphics = self.attachAsset('spike', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ self.x = x;
+ self.y = y;
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x222222
+});
+
+/****
+* Game Code
+****/
+// Game states
+var gameState = 'menu'; // 'menu' or 'playing'
+var currentLevel = 1;
+var maxLevels = 50;
+var groundLevel = 2400;
+var cameraX = 0;
+var scrollSpeed = 5;
+// Player variables
+var player;
+var playerStartX = 300;
+var playerStartY = groundLevel;
+// Level data
+var obstacles = [];
+var platforms = [];
+var grounds = [];
+var checkpoints = [];
+var currentCheckpoint = 0;
+var levelData = {};
+// UI elements
+var levelButtons = [];
+var backButton;
+var levelCompleteText;
+var deathCount = 0;
+// Storage initialization
+if (!storage.completedLevels) {
+ storage.completedLevels = {};
+}
+if (!storage.currentLevel) {
+ storage.currentLevel = 1;
+}
+// Initialize level data (simplified patterns)
+function initializeLevelData() {
+ for (var i = 1; i <= maxLevels; i++) {
+ levelData[i] = {
+ spikes: [],
+ platforms: [],
+ checkpoints: [],
+ length: 3000 + i * 200 // Levels get longer
+ };
+ // Generate simple spike patterns
+ var spikeCount = 5 + Math.floor(i / 2);
+ for (var j = 0; j < spikeCount; j++) {
+ var spikeX = 800 + j * (200 + i * 10);
+ levelData[i].spikes.push({
+ x: spikeX,
+ y: groundLevel
+ });
+ }
+ // Add checkpoints every 1000 pixels
+ var checkpointCount = Math.floor(levelData[i].length / 1000);
+ for (var k = 1; k <= checkpointCount; k++) {
+ levelData[i].checkpoints.push({
+ x: k * 1000,
+ y: groundLevel
+ });
+ }
+ // Add some platforms for variety
+ if (i > 5) {
+ var platformCount = Math.floor(i / 5);
+ for (var p = 0; p < platformCount; p++) {
+ var platformX = 1200 + p * 400;
+ var platformY = groundLevel - 150 - p % 2 * 100;
+ levelData[i].platforms.push({
+ x: platformX,
+ y: platformY,
+ width: 200
+ });
+ }
+ }
+ }
+}
+// UI Setup
+function setupUI() {
+ // Score display
+ var scoreText = new Text2('Level: ' + currentLevel, {
+ size: 60,
+ fill: 0xFFFFFF
+ });
+ scoreText.anchor.set(0, 0);
+ scoreText.x = 120;
+ scoreText.y = 50;
+ LK.gui.topLeft.addChild(scoreText);
+}
+// Level selection menu
+function showLevelMenu() {
+ gameState = 'menu';
+ game.removeChildren();
+ levelButtons = [];
+ // Title
+ var titleText = new Text2('Geometry Dash: 50 Levels', {
+ size: 80,
+ fill: 0xFFFFFF
+ });
+ titleText.anchor.set(0.5, 0);
+ titleText.x = 1024;
+ titleText.y = 200;
+ game.addChild(titleText);
+ // Create level buttons in grid
+ var buttonsPerRow = 5;
+ var buttonSpacing = 220;
+ var startX = 1024 - (buttonsPerRow - 1) * buttonSpacing / 2;
+ var startY = 400;
+ for (var i = 1; i <= maxLevels; i++) {
+ var row = Math.floor((i - 1) / buttonsPerRow);
+ var col = (i - 1) % buttonsPerRow;
+ var buttonX = startX + col * buttonSpacing;
+ var buttonY = startY + row * 150;
+ var levelBtn = game.addChild(new LevelButton(i, buttonX, buttonY));
+ levelButtons.push(levelBtn);
+ }
+}
+// Show gameplay
+function showGameplay() {
+ gameState = 'playing';
+ game.removeChildren();
+ // Reset camera
+ cameraX = 0;
+ currentCheckpoint = 0;
+ deathCount = 0;
+ // Create player
+ player = game.addChild(new Player());
+ player.x = playerStartX;
+ player.y = playerStartY;
+ // Load current level
+ loadLevel(currentLevel);
+}
+// Load level obstacles
+function loadLevel(levelNum) {
+ obstacles = [];
+ platforms = [];
+ grounds = [];
+ checkpoints = [];
+ var level = levelData[levelNum];
+ // Create ground segments
+ for (var x = 0; x <= level.length + 1000; x += 200) {
+ var ground = game.addChild(new Ground(x, groundLevel, 200));
+ grounds.push(ground);
+ }
+ // Create spikes
+ for (var i = 0; i < level.spikes.length; i++) {
+ var spikeData = level.spikes[i];
+ var spike = game.addChild(new Spike(spikeData.x, spikeData.y));
+ obstacles.push(spike);
+ }
+ // Create platforms
+ for (var j = 0; j < level.platforms.length; j++) {
+ var platformData = level.platforms[j];
+ var platform = game.addChild(new Platform(platformData.x, platformData.y, platformData.width));
+ platforms.push(platform);
+ }
+ // Create checkpoints
+ for (var k = 0; k < level.checkpoints.length; k++) {
+ var checkpointData = level.checkpoints[k];
+ var checkpoint = game.addChild(new Checkpoint(checkpointData.x, checkpointData.y));
+ checkpoints.push(checkpoint);
+ }
+}
+// Handle player death
+function handlePlayerDeath() {
+ if (player.isDead) return;
+ player.isDead = true;
+ deathCount++;
+ LK.effects.flashScreen(0xff0000, 500);
+ LK.getSound('death').play();
+ // Respawn after delay
+ LK.setTimeout(function () {
+ respawnPlayer();
+ }, 1000);
+}
+// Respawn player at checkpoint
+function respawnPlayer() {
+ player.isDead = false;
+ player.velocityY = 0;
+ player.isGrounded = false;
+ if (currentCheckpoint > 0 && checkpoints[currentCheckpoint - 1]) {
+ player.x = checkpoints[currentCheckpoint - 1].x;
+ cameraX = checkpoints[currentCheckpoint - 1].x - 400;
+ } else {
+ player.x = playerStartX;
+ cameraX = 0;
+ }
+ player.y = groundLevel;
+}
+// Handle level completion
+function completeLevel() {
+ storage.completedLevels[currentLevel] = true;
+ LK.getSound('complete').play();
+ LK.effects.flashScreen(0x00ff00, 1000);
+ // Show completion message
+ var completeText = new Text2('Level Complete!', {
+ size: 100,
+ fill: 0x00FF00
+ });
+ completeText.anchor.set(0.5, 0.5);
+ completeText.x = 1024;
+ completeText.y = 1366;
+ game.addChild(completeText);
+ // Return to menu after delay
+ LK.setTimeout(function () {
+ showLevelMenu();
+ }, 2000);
+}
+// Input handling
+game.down = function (x, y, obj) {
+ if (gameState === 'playing' && player && !player.isDead) {
+ player.jump();
+ }
+};
+// Main game loop
+game.update = function () {
+ if (gameState !== 'playing' || !player || player.isDead) return;
+ // Auto-scroll camera
+ cameraX += scrollSpeed;
+ player.x += scrollSpeed;
+ // Update camera position
+ var targetCameraX = player.x - 400;
+ if (targetCameraX > cameraX) {
+ cameraX = targetCameraX;
+ }
+ // Position all game objects relative to camera
+ game.x = -cameraX;
+ // Check obstacle collisions
+ for (var i = 0; i < obstacles.length; i++) {
+ var obstacle = obstacles[i];
+ if (player.intersects(obstacle)) {
+ handlePlayerDeath();
+ break;
+ }
+ }
+ // Check platform collisions (simple top collision)
+ for (var j = 0; j < platforms.length; j++) {
+ var platform = platforms[j];
+ if (player.intersects(platform) && player.velocityY > 0) {
+ var playerBottom = player.y;
+ var platformTop = platform.y;
+ if (playerBottom >= platformTop && playerBottom <= platformTop + 20) {
+ player.y = platformTop;
+ player.velocityY = 0;
+ player.isGrounded = true;
+ }
+ }
+ }
+ // Check checkpoint activation
+ for (var k = 0; k < checkpoints.length; k++) {
+ var checkpoint = checkpoints[k];
+ if (!checkpoint.activated && player.intersects(checkpoint)) {
+ checkpoint.activated = true;
+ currentCheckpoint = k + 1;
+ LK.effects.flashObject(checkpoint, 0x00ffff, 500);
+ }
+ }
+ // Check level completion
+ var levelLength = levelData[currentLevel].length;
+ if (player.x >= levelLength) {
+ completeLevel();
+ }
+ // Check if player fell off screen
+ if (player.y > 2800) {
+ handlePlayerDeath();
+ }
+};
+// Initialize game
+initializeLevelData();
+setupUI();
+showLevelMenu();
\ No newline at end of file