User prompt
Slide right to move is not working properly
User prompt
Slide to move litte fast 5sec
User prompt
When we punch the obstacles it should be fall down or disappear
User prompt
Create a 2D cartoon-style punch effect for a side-scrolling mobile game. Show a big, exaggerated punch with motion blur, comic-style “BAM!” or “POW!” text, and a shockwave ripple at the point of impact. Include flying stars or sparks, and a dust cloud at the ground. The style should be funny, colorful, and dynamic, inspired by classic cartoon fight scenes. Suitable for use in a punch mechanic where a character clears obstacles with a strong hit.
User prompt
Remove the building asset
Code edit (1 edits merged)
Please save this source code
User prompt
Samosa Rush
Initial prompt
Title: Samosa Rush --- Concept: Join Motlu, the ever-hungry hero of Furfuri Nagar, on a wild run through the bustling streets to collect his favorite snack — samosas! But it’s not that easy — obstacles, cows, barrels, and street chaos stand in his way. How many samosas can you collect before it all goes downhill? --- Core Mechanics: 1. Endless Auto-Run Motlu runs automatically from left to right. The environment scrolls endlessly as long as you survive. 2. Tap to Jump Tap once to jump over obstacles or collect samosas in mid-air. Optionally: Double tap for a double jump (upgrade later). 3. Collectibles: Samosas Floating samosas give +1 point. Score increases as you collect more. 4. Obstacles Random cows, barrels, or potholes appear. Hitting any obstacle ends the game. 5. Power-Ups (Optional) Jetpack: Fly for 3 seconds. Slow Motion (Patlu’s Gadget): Slows down time temporarily. Shield: Protects from one hit. 6. Increasing Difficulty Game speed increases every 30 seconds. Obstacles come faster and more frequently. 7. Score & UI Score counter at the top. Game Over screen with best score and retry button.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { highScore: 0 }); /**** * Classes ****/ var Background = Container.expand(function (type, yPos, speed) { var self = Container.call(this); self.type = type; self.speed = speed || 1; var bgGraphics = self.attachAsset(self.type, { anchorX: 0, anchorY: 0, y: yPos || 0 }); // Create duplicate for infinite scrolling var bgGraphics2 = self.attachAsset(self.type, { anchorX: 0, anchorY: 0, x: bgGraphics.width, y: yPos || 0 }); self.elements = [bgGraphics, bgGraphics2]; self.update = function () { for (var i = 0; i < self.elements.length; i++) { var element = self.elements[i]; element.x -= self.speed; // Reset position when element is completely off-screen if (element.x <= -element.width) { element.x = self.elements[(i + 1) % 2].x + element.width - 10; // -10 to avoid gaps } } }; return self; }); var Collectible = Container.expand(function (type) { var self = Container.call(this); self.type = type || 'samosa'; self.speed = 8; self.value = 1; if (self.type === 'jetpack' || self.type === 'shield') { self.value = 0; // Power-ups don't give score directly } var collectibleGraphics = self.attachAsset(self.type, { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.x -= self.speed; // Floating animation self.y += Math.sin(LK.ticks / 10) * 0.5; // Remove if off screen if (self.x < -collectibleGraphics.width) { self.remove = true; } }; return self; }); var Obstacle = Container.expand(function (type) { var self = Container.call(this); self.type = type || 'cow'; self.speed = 8; var obstacleGraphics = self.attachAsset(self.type, { anchorX: 0.5, anchorY: 1 }); self.update = function () { self.x -= self.speed; // Remove if off screen if (self.x < -obstacleGraphics.width) { self.remove = true; } }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 1 }); self.velocityY = 0; self.gravity = 1; self.jumpForce = -22; self.isJumping = false; self.isSliding = false; self.slideTimer = 0; self.hasShield = false; self.hasJetpack = false; self.jetpackTimer = 0; self.shieldTimer = 0; self.jump = function () { if (!self.isJumping) { self.velocityY = self.jumpForce; self.isJumping = true; LK.getSound('jump').play(); } }; self.slide = function () { if (!self.isSliding) { self.isSliding = true; self.slideTimer = 300; // 5 seconds at 60 FPS self.speedBoost = 2; // Double the speed LK.getSound('powerup').play(); } }; self.update = function () { // Handle sliding if (self.isSliding) { self.slideTimer--; if (self.slideTimer <= 0) { self.isSliding = false; self.speedBoost = 1; // Reset speed } else { self.x += self.speedBoost; // Apply speed boost during slide } } // Apply gravity self.velocityY += self.gravity; self.y += self.velocityY; // Ground collision if (self.y >= self.groundY) { self.y = self.groundY; self.velocityY = 0; self.isJumping = false; } // Jetpack power-up if (self.hasJetpack) { self.jetpackTimer--; if (self.jetpackTimer <= 0) { self.hasJetpack = false; } else { // Float higher with jetpack self.velocityY = -5; } } // Shield timer if (self.hasShield) { self.shieldTimer--; if (self.shieldTimer <= 0) { self.hasShield = false; playerGraphics.tint = 0xFFFFFF; // Reset tint } } }; self.activateJetpack = function () { self.hasJetpack = true; self.jetpackTimer = 180; // 3 seconds at 60 FPS LK.getSound('powerup').play(); }; self.activateShield = function () { self.hasShield = true; self.shieldTimer = 300; // 5 seconds at 60 FPS playerGraphics.tint = 0x4169E1; // Blue tint to indicate shield LK.getSound('powerup').play(); }; return self; }); var PunchEffect = Container.expand(function () { var self = Container.call(this); // Create the punch text var punchText = new Text2('BAM!', { size: 200, fill: 0xFF0000, font: "'Comic Sans MS', cursive, sans-serif" }); punchText.anchor.set(0.5); self.addChild(punchText); // Create the shockwave ripple var shockwave = LK.getAsset('clouds', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); self.addChild(shockwave); // Create flying stars var stars = []; for (var i = 0; i < 5; i++) { var star = LK.getAsset('samosa', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.3, scaleY: 0.3 }); stars.push(star); self.addChild(star); } // Create dust cloud var dustCloud = LK.getAsset('clouds', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 0.5 }); self.addChild(dustCloud); // Animation logic self.update = function () { // Animate punch text punchText.alpha -= 0.02; punchText.y -= 2; // Animate shockwave shockwave.alpha -= 0.02; shockwave.scaleX += 0.02; shockwave.scaleY += 0.02; // Animate stars for (var i = 0; i < stars.length; i++) { var star = stars[i]; star.alpha -= 0.02; star.x += Math.cos(i) * 2; star.y += Math.sin(i) * 2; } // Animate dust cloud dustCloud.alpha -= 0.02; dustCloud.scaleX += 0.01; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ // Game config var gameSpeed = 1; var score = 0; var obstacles = []; var collectibles = []; var backgrounds = []; var isGameActive = true; var obstacleSpawnRate = 90; // Frames between spawns var collectibleSpawnRate = 60; // Frames between spawns var lastObstacleSpawn = 0; var lastCollectibleSpawn = 0; var groundLevel = 2500; // Set up UI var scoreTxt = new Text2('SCORE: 0', { size: 60, fill: 0xFFFFFF }); scoreTxt.anchor.set(0, 0); LK.gui.topRight.addChild(scoreTxt); var highScoreTxt = new Text2('HIGH SCORE: ' + storage.highScore, { size: 40, fill: 0xFFFFFF }); highScoreTxt.anchor.set(1, 0); highScoreTxt.y = 70; LK.gui.topRight.addChild(highScoreTxt); // Create Backgrounds var skyBg = game.addChild(new Background('background', 0, 0)); var cloudsBg = game.addChild(new Background('clouds', 300, 1)); backgrounds.push(skyBg, cloudsBg); // Create Ground var ground = LK.getAsset('ground', { anchorX: 0, anchorY: 0, y: groundLevel }); game.addChild(ground); // Create Player var player = game.addChild(new Player()); player.x = 400; player.y = groundLevel; player.groundY = groundLevel; // Game functions function spawnObstacle() { var types = ['cow', 'barrel', 'pothole']; var obstacleType = types[Math.floor(Math.random() * types.length)]; var obstacle = new Obstacle(obstacleType); obstacle.x = 2200; // Spawn just off-screen to the right // Set y position based on obstacle type if (obstacleType === 'pothole') { obstacle.y = groundLevel + 10; // Potholes sit on the ground } else { obstacle.y = groundLevel; } obstacle.speed = 8 * gameSpeed; obstacles.push(obstacle); game.addChild(obstacle); } function spawnCollectible() { var types = ['samosa', 'samosa', 'samosa', 'jetpack', 'shield']; // 60% samosa, 20% jetpack, 20% shield var collectibleType = types[Math.floor(Math.random() * types.length)]; var collectible = new Collectible(collectibleType); collectible.x = 2200; // Spawn just off-screen to the right // Position samosas and power-ups at different heights if (collectibleType === 'samosa') { collectible.y = groundLevel - 200 - Math.random() * 200; // Random height above ground } else { collectible.y = groundLevel - 300 - Math.random() * 100; // Power-ups higher up } collectible.speed = 8 * gameSpeed; collectibles.push(collectible); game.addChild(collectible); } function checkCollisions() { // Check obstacle collisions for (var i = obstacles.length - 1; i >= 0; i--) { var obstacle = obstacles[i]; if (player.intersects(obstacle)) { // Trigger punch effect var punchEffect = new PunchEffect(); punchEffect.x = player.x; punchEffect.y = player.y; game.addChild(punchEffect); // Make obstacle fall down or disappear obstacle.remove = true; obstacle.destroy(); obstacles.splice(i, 1); // Update high score if (score > storage.highScore) { storage.highScore = score; highScoreTxt.setText('HIGH SCORE: ' + storage.highScore); } } // Remove obstacles marked for removal if (obstacle.remove) { obstacle.destroy(); obstacles.splice(i, 1); } } // Check collectible collisions for (var j = collectibles.length - 1; j >= 0; j--) { var collectible = collectibles[j]; if (player.intersects(collectible)) { // Handle collectible based on type if (collectible.type === 'samosa') { score += collectible.value; scoreTxt.setText('SCORE: ' + score); LK.getSound('collect').play(); } else if (collectible.type === 'jetpack') { player.activateJetpack(); } else if (collectible.type === 'shield') { player.activateShield(); } // Remove collected item collectible.destroy(); collectibles.splice(j, 1); } // Remove collectibles marked for removal if (collectible.remove) { collectible.destroy(); collectibles.splice(j, 1); } } } function increaseGameDifficulty() { // Increase game speed as score increases gameSpeed = 1 + score / 100; // Max speed increase is capped by design // Update speed of all active objects for (var i = 0; i < obstacles.length; i++) { obstacles[i].speed = 8 * gameSpeed; } for (var j = 0; j < collectibles.length; j++) { collectibles[j].speed = 8 * gameSpeed; } // Increase background parallax speeds if (backgrounds[1]) { backgrounds[1].speed = 1 * gameSpeed; } // clouds if (backgrounds[2]) { backgrounds[2].speed = 2 * gameSpeed; } // buildings // Adjust spawn rates obstacleSpawnRate = Math.max(30, 90 - Math.floor(score / 20)); } // Handle touch/click input game.down = function (x, y) { if (isGameActive) { if (x < 1024) { // Assuming left half of the screen for jump player.jump(); } else { // Right half of the screen for slide player.slide(); } } }; // Main game update loop game.update = function () { if (!isGameActive) { return; } // Update player player.update(); if (player.isSliding) { player.x += player.speedBoost; // Apply speed boost } // Update backgrounds for (var i = 0; i < backgrounds.length; i++) { backgrounds[i].update(); } // Spawn obstacles with timing based on game speed lastObstacleSpawn++; if (lastObstacleSpawn >= obstacleSpawnRate / gameSpeed) { spawnObstacle(); lastObstacleSpawn = 0; } // Spawn collectibles lastCollectibleSpawn++; if (lastCollectibleSpawn >= collectibleSpawnRate / gameSpeed) { spawnCollectible(); lastCollectibleSpawn = 0; } // Update obstacles for (var j = 0; j < obstacles.length; j++) { obstacles[j].update(); } // Update collectibles for (var k = 0; k < collectibles.length; k++) { collectibles[k].update(); } // Check for collisions checkCollisions(); // Adjust game difficulty increaseGameDifficulty(); // Automatically increment score over time if (LK.ticks % 60 === 0) { score += 1; scoreTxt.setText('SCORE: ' + score); } }; // Play background music LK.playMusic('bgmusic');
===================================================================
--- original.js
+++ change.js
@@ -115,8 +115,10 @@
self.slideTimer--;
if (self.slideTimer <= 0) {
self.isSliding = false;
self.speedBoost = 1; // Reset speed
+ } else {
+ self.x += self.speedBoost; // Apply speed boost during slide
}
}
// Apply gravity
self.velocityY += self.gravity;
Create a cute and shiny 2D samosa with a golden-brown crispy texture. It should have a smiley face and a slight glow, making it look collectible and delicious. The art style should be cartoonish and exaggerated for a fun game.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Create a spicy red samosa with flames, symbolizing a speed boost. The samosa should have a glowing effect and fire particles around it.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Create 2D cartoon-style Indian street buildings for a side-scrolling background. Include colorful shops with Hindi signboards, tea stalls, fruit carts, clotheslines with hanging clothes, and balconies with flower pots. Add hanging wires, fans, and posters on the walls for detail. Style should be vibrant, humorous, and full of character, matching a fun endless runner game..fore ground sky with sun Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Inspector chingam on police bike with police dress. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows