User prompt
Karakterle beraber hareket etmesin poweruplar
User prompt
Ekrana powerup ları görsel olarak ekle
User prompt
Powerupları ekle plartformların üstünde olsun %10 oranla çıksın
User prompt
Geri al
User prompt
Powerup oluşumunu plartformların üstünde rasgele çıkabilir hale getir 10 plartformda 1 olsun
User prompt
Powerup class ını ekrana ekle ve karakter ona dokunursa 1.5 x jump olsun 3 saniyeline
User prompt
Plartform şeklini elips yap
User prompt
Plartformlar köşeleri yumuşak olsun
User prompt
Her zıplama için bir ses ekle
User prompt
Değişiklikleri geri al
User prompt
Maximum zıplama mesafesini hesapla ve asla zıplama imkansız plartform oluşturma
Code edit (1 edits merged)
Please save this source code
User prompt
Jump Up: Sonsuz Platform Macerası
Initial prompt
Bir platform bazlı parkur oyunu istiyorum yukarı doğru otomatik zıplayan karaktere sağ sol diye yön verelim ve plartformlar random seed le oluşturulsun y ekseni ilerledikçe oluşmaya devam etsin oluşan plartformlar aynı olmasın gene random olsun
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Platform class: a static platform the player can land on var Platform = Container.expand(function () { var self = Container.call(this); // Platform asset: random width, fixed height, color // Platform width will be set on creation self.width = 400; // default, will be overwritten self.height = 40; self.color = 0x4ecdc4; // Attach asset var platAsset = self.attachAsset('platform', { width: self.width, height: self.height, color: self.color, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5 }); // For collision, always use self.x/y and self.width/height // Update platform asset size if needed self.setSize = function (w, h) { self.width = w; self.height = h; platAsset.width = w; platAsset.height = h; }; return self; }); // Player class: the jumping character var Player = Container.expand(function () { var self = Container.call(this); // Attach asset var playerAsset = self.attachAsset('player', { width: 100, height: 100, color: 0xf67280, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5 }); // Physics self.vx = 0; self.vy = 0; self.radius = 50; // for collision self.isJumping = false; // For touch controls self.moveLeft = function () { self.vx = -playerMoveSpeed; }; self.moveRight = function () { self.vx = playerMoveSpeed; }; self.stopMove = function () { self.vx = 0; }; // For jump self.jump = function () { self.vy = -playerJumpVelocity; self.isJumping = true; LK.getSound('jump').play(); }; return self; }); // Powerup class: a collectible that gives jump boost var Powerup = Container.expand(function () { var self = Container.call(this); // Attach a visible asset (ellipse, yellow) var asset = self.attachAsset('powerup', { width: 60, height: 60, color: 0xffe066, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5 }); // For collision, use self.x/y and asset size self.radius = 30; // Track if already collected self.collected = false; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x22223b }); /**** * Game Code ****/ // --- Constants --- var GAME_WIDTH = 2048; var GAME_HEIGHT = 2732; var PLATFORM_MIN_WIDTH = 300; var PLATFORM_MAX_WIDTH = 600; var PLATFORM_HEIGHT = 40; var PLATFORM_MIN_GAP = 250; var PLATFORM_MAX_GAP = 600; var PLATFORM_SIDE_MARGIN = 100; var PLATFORM_COLOR = 0x4ecdc4; var PLAYER_START_X = GAME_WIDTH / 2; var PLAYER_START_Y = GAME_HEIGHT - 400; var playerMoveSpeed = 18; var playerJumpVelocity = 60; var gravity = 3.2; var maxFallSpeed = 60; var scrollThreshold = GAME_HEIGHT / 2; var platformScrollSpeed = 0; // will be set dynamically // --- State --- var platforms = []; var player; var score = 0; var scoreTxt; var highestY = PLAYER_START_Y; var dragDir = 0; // -1: left, 1: right, 0: none var isTouching = false; var lastTouchX = 0; var lastTouchY = 0; var gameOver = false; // --- Powerup State --- var powerups = []; var jumpBoostActive = false; var jumpBoostTimeout = null; // --- Helper: Spawn Powerup --- function spawnPowerup(x, y) { var p = new Powerup(); p.x = x; p.y = y - 80; // float above platform p.visible = true; // ensure powerup is visible when spawned powerups.push(p); game.addChild(p); return p; } // --- GUI --- scoreTxt = new Text2('0', { size: 120, fill: "#fff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // --- Helper: Platform Generation --- function randomPlatformWidth() { return PLATFORM_MIN_WIDTH + Math.floor(Math.random() * (PLATFORM_MAX_WIDTH - PLATFORM_MIN_WIDTH)); } function randomPlatformX(width) { var minX = PLATFORM_SIDE_MARGIN + width / 2; var maxX = GAME_WIDTH - PLATFORM_SIDE_MARGIN - width / 2; return minX + Math.random() * (maxX - minX); } function randomPlatformGap() { return PLATFORM_MIN_GAP + Math.random() * (PLATFORM_MAX_GAP - PLATFORM_MIN_GAP); } // --- Helper: Platform Creation --- function createPlatform(x, y, width) { var plat = new Platform(); plat.setSize(width, PLATFORM_HEIGHT); plat.x = x; plat.y = y; platforms.push(plat); game.addChild(plat); // Powerup: spawn with 10% chance on top of platform if (Math.random() < 0.10) { spawnPowerup(x, y - PLATFORM_HEIGHT / 2); } return plat; } // --- Helper: Remove platform --- function removePlatform(plat) { var idx = platforms.indexOf(plat); if (idx !== -1) { platforms.splice(idx, 1); } plat.destroy(); } // --- Helper: Collision Detection (AABB) --- function playerOnPlatform(player, plat) { // Only check if player is falling if (player.vy < 0) return false; // Player bottom var px = player.x; var py = player.y + player.radius * 0.8; // Platform bounds var left = plat.x - plat.width / 2; var right = plat.x + plat.width / 2; var top = plat.y - plat.height / 2; var bottom = plat.y + plat.height / 2; // Check if player is above platform and within x bounds if (py > top && py < bottom && px > left && px < right) { return true; } return false; } // --- Helper: Generate Initial Platforms --- function generateInitialPlatforms() { var y = PLAYER_START_Y + 200; // First platform: wide, centered, at bottom createPlatform(GAME_WIDTH / 2, y, 600); // Generate upwards while (y > 400) { y -= randomPlatformGap(); var width = randomPlatformWidth(); var x = randomPlatformX(width); createPlatform(x, y, width); } } // --- Helper: Generate New Platforms Above --- function generatePlatformsIfNeeded() { // Find highest platform var highestPlatY = GAME_HEIGHT; for (var i = 0; i < platforms.length; i++) { if (platforms[i].y < highestPlatY) highestPlatY = platforms[i].y; } // If highest platform is below a threshold, add more above while (highestPlatY > -200) { var width = randomPlatformWidth(); var x = randomPlatformX(width); var gap = randomPlatformGap(); highestPlatY -= gap; createPlatform(x, highestPlatY, width); } } // --- Helper: Remove Offscreen Platforms --- function removeOffscreenPlatforms() { for (var i = platforms.length - 1; i >= 0; i--) { if (platforms[i].y > GAME_HEIGHT + 200) { removePlatform(platforms[i]); } } } // --- Helper: Update Score --- function updateScore() { // Score is highestY reached (inverted, since y decreases as we go up) var newScore = Math.max(0, Math.floor((PLAYER_START_Y - highestY) / 10)); if (newScore > score) { score = newScore; scoreTxt.setText(score); } } // --- Game Setup --- function resetGame() { // Remove old platforms for (var i = 0; i < platforms.length; i++) { platforms[i].destroy(); } platforms = []; // Remove old powerups for (var i = 0; i < powerups.length; i++) { powerups[i].destroy(); } powerups = []; // Remove player if exists if (player) player.destroy(); // Reset state score = 0; scoreTxt.setText(score); highestY = PLAYER_START_Y; dragDir = 0; isTouching = false; lastTouchX = 0; lastTouchY = 0; gameOver = false; jumpBoostActive = false; if (jumpBoostTimeout) { LK.clearTimeout(jumpBoostTimeout); jumpBoostTimeout = null; } // Reset platform count for powerup spawn createPlatform.platformCount = 0; // Generate platforms generateInitialPlatforms(); // Create player player = new Player(); player.x = PLAYER_START_X; player.y = PLAYER_START_Y; player.vx = 0; player.vy = 0; player.isJumping = false; game.addChild(player); } // --- Input Handling (Touch/Drag) --- game.down = function (x, y, obj) { if (gameOver) return; isTouching = true; lastTouchX = x; lastTouchY = y; // Determine left/right based on touch position if (x < GAME_WIDTH / 2) { dragDir = -1; player.moveLeft(); } else { dragDir = 1; player.moveRight(); } }; game.move = function (x, y, obj) { if (gameOver) return; if (!isTouching) return; // If finger crosses center, switch direction if (dragDir === -1 && x > GAME_WIDTH / 2) { dragDir = 1; player.moveRight(); } else if (dragDir === 1 && x < GAME_WIDTH / 2) { dragDir = -1; player.moveLeft(); } lastTouchX = x; lastTouchY = y; }; game.up = function (x, y, obj) { if (gameOver) return; isTouching = false; dragDir = 0; player.stopMove(); }; // --- Main Game Loop --- game.update = function () { if (gameOver) return; // --- Player Physics --- // Horizontal movement player.x += player.vx; // Clamp to screen if (player.x < player.radius) player.x = player.radius; if (player.x > GAME_WIDTH - player.radius) player.x = GAME_WIDTH - player.radius; // Vertical movement player.y += player.vy; player.vy += gravity; if (player.vy > maxFallSpeed) player.vy = maxFallSpeed; // --- Platform Collision --- var landed = false; for (var i = 0; i < platforms.length; i++) { if (playerOnPlatform(player, platforms[i])) { // Only allow landing if falling if (player.vy >= 0) { player.y = platforms[i].y - platforms[i].height / 2 - player.radius * 0.8; player.jump(); landed = true; break; } } } // --- Scrolling --- // If player is above scroll threshold, move everything down if (player.y < scrollThreshold) { var dy = scrollThreshold - player.y; player.y = scrollThreshold; // Move all platforms down for (var i = 0; i < platforms.length; i++) { platforms[i].y += dy; } // Powerups should NOT move with platforms, so do nothing here for powerups // Track highestY highestY -= dy; } else { // Track highestY if (player.y < highestY) highestY = player.y; } // --- Remove Offscreen Platforms & Generate New Ones --- removeOffscreenPlatforms(); generatePlatformsIfNeeded(); // --- Powerup Collision --- for (var i = powerups.length - 1; i >= 0; i--) { var p = powerups[i]; if (!p.collected) { // Simple circle collision var dx = player.x - p.x; var dy = player.y - p.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < player.radius + p.radius) { // Collect powerup p.collected = true; p.visible = false; // Activate jump boost jumpBoostActive = true; playerJumpVelocity = 90; // 1.5x original (60) // Clear previous timeout if any if (jumpBoostTimeout) LK.clearTimeout(jumpBoostTimeout); jumpBoostTimeout = LK.setTimeout(function () { jumpBoostActive = false; playerJumpVelocity = 60; jumpBoostTimeout = null; }, 3000); } } } // --- Remove collected/offscreen powerups --- for (var i = powerups.length - 1; i >= 0; i--) { var p = powerups[i]; if (p.collected || p.y > GAME_HEIGHT + 200) { p.destroy(); powerups.splice(i, 1); } } // --- Update Score --- updateScore(); // --- Game Over: Fell below screen --- if (player.y > GAME_HEIGHT + 200) { gameOver = true; LK.effects.flashScreen(0xff0000, 800); LK.showGameOver(); } }; // --- Start Game --- resetGame();
===================================================================
--- original.js
+++ change.js
@@ -355,8 +355,9 @@
// Move all platforms down
for (var i = 0; i < platforms.length; i++) {
platforms[i].y += dy;
}
+ // Powerups should NOT move with platforms, so do nothing here for powerups
// Track highestY
highestY -= dy;
} else {
// Track highestY
Cartoon bir astronot. In-Game asset. 2d. High contrast. No shadows
Cartoon bir astronot. In-Game asset. 2d. High contrast. No shadows
İskender kebap. In-Game asset. 2d. High contrast. No shadows
Nebula uzay arkaplan nebula oranı 3/10 olsun. In-Game asset. 2d. High contrast. No shadows
Fullscreen modern App Store landscape banner, 16:9, high definition, for a game titled "Jump Up: Sonsuz Platform Macerası" and with the description astronot in the moon"Karakterin otomatik zıpladığı, sağ-sol yönlendirme ile platformlarda yükseldiğin sonsuz bir parkur oyunu. Platformlar rastgele ve benzersiz şekilde oluşur.". No text on banner!