User prompt
birazdaha detay derinligi eklermisin rica etsem
User prompt
kuşlar biraz dağınık uçsun beraber degil
User prompt
kuşları bikaçtane yaparmısın
User prompt
kuşları çok azıcık indirmisn
User prompt
kuşlar birazdaha lütfen yüksekten uçsun
User prompt
kuşlar birazdaha yüksekten uçsun lütfen
User prompt
kuşlar birazdaha yüksekten uçsun lütfen
User prompt
oyuna kuş eklermisin
User prompt
arka plana güneş eklermisin
User prompt
extra bir dızın acara k gunes olusturabilirmisin
User prompt
güneş ekerlmisin rica etsem ekstra olarak
User prompt
güneş için ayrı bir dizin oluştur lütfen
User prompt
bulut ve güneş detayı eklermisin
User prompt
çöl iklimine bir kaç detay daha eklermisin piramit vs gibi
User prompt
öl ilkimine bir kaç detay daha eklermisin rica etsem
User prompt
siyah olan arka planı birazdaha çöl iklimi olarak degiştirmisin
User prompt
altını alması için kedinin ona değmesi yetsin
User prompt
ektra bir scor tablosu olusturup kedinin alabilcegi altın da oyuna eksra olarak eklermisn rica etsem
User prompt
çift zıplama eklermisin rica etsem
User prompt
üzerine glen birde hayalet eklermisn rica etsem extradan
User prompt
kaktüs sıklıgını zıplama imkanı verecek şekilde yeniden düzenlermisin
User prompt
zıpladıktan sonra 100 msn havada kalsın
User prompt
zıpladıktan sonra 30msn havada
User prompt
birazdaha çok az daha kısa zıplasın
User prompt
oyun ilerledikçe hızlansın
/**** * Classes ****/ // Cactus class: moves left, destroys itself off screen var Cactus = Container.expand(function () { var self = Container.call(this); // Attach cactus asset, anchor bottom left var cactusSprite = self.attachAsset('cactus', { anchorX: 0.5, anchorY: 1 }); self.speed = 7 + Math.random() * 2; // even slower speed for easier gameplay self.update = function () { self.x -= self.speed; // Destroy if off screen if (self.lastX >= -200 && self.x < -200) { self.destroy(); } self.lastX = self.x; }; return self; }); // Cat class: handles jump, gravity, and collision var Cat = Container.expand(function () { var self = Container.call(this); // Attach cat asset, anchor bottom left for ground logic var catSprite = self.attachAsset('cat', { anchorX: 0.5, anchorY: 1 }); // Cat physics self.y = 0; self.x = 0; self.vy = 0; self.isJumping = false; self.groundY = 0; // will be set after creation // Double jump state self.jumpCount = 0; self.maxJumps = 2; // Jump parameters self.jumpVelocity = -65; self.gravity = 4; // Update method for physics self.update = function () { if (self.isJumping) { // If we are hovering, do not apply gravity or move if (self.isHovering) { // Check if hover time is over if (LK.ticks - self.hoverStartTick >= 6) { // 100ms at 60 FPS self.isHovering = false; // Resume falling, keep vy as 0 so gravity starts pulling down self.vy = 0; } // While hovering, do nothing else return; } // Normal jump/fall self.vy += self.gravity; self.y += self.vy; // At apex: vy just turned positive (was going up, now going down) if (!self.isHovering && self.vy > 0 && !self.hasHovered) { self.isHovering = true; self.hasHovered = true; self.hoverStartTick = LK.ticks; self.vy = 0; // Stop vertical movement during hover return; } // Land on ground if (self.y >= self.groundY) { self.y = self.groundY; self.vy = 0; self.isJumping = false; self.isHovering = false; self.hasHovered = false; self.jumpCount = 0; // Reset jump count on landing } } }; // Jump method self.jump = function () { if (self.jumpCount < self.maxJumps) { self.isJumping = true; self.vy = self.jumpVelocity; self.isHovering = false; self.hasHovered = false; self.hoverStartTick = 0; self.jumpCount++; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ ; // --- GAME CODE --- // Game constants var GROUND_Y = 2200; // y position of ground (bottom of screen minus margin) var CAT_START_X = 400; var CAT_START_Y = GROUND_Y; var CACTUS_SPAWN_MIN = 40; // min frames between cacti (more frequent) var CACTUS_SPAWN_MAX = 80; // max frames between cacti (more frequent) // Game state var cat; var cacti = []; var score = 0; var scoreTxt; var nextCactusTick = 0; var gameOver = false; // Speed multiplier for game progression var speedMultiplier = 1; var SPEED_MULTIPLIER_INCREMENT = 0.08; // how much to increase per score var SPEED_MULTIPLIER_MAX = 3; // cap the speed increase // Add score text to GUI scoreTxt = new Text2('0', { size: 120, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Create cat cat = new Cat(); cat.x = CAT_START_X; cat.y = CAT_START_Y; cat.groundY = CAT_START_Y; game.addChild(cat); // Touch/click to jump game.down = function (x, y, obj) { if (!gameOver) { cat.jump(); } }; // Main update loop game.update = function () { if (gameOver) return; // Update cat cat.update(); // Spawn cactus if (nextCactusTick <= 0) { var cactus = new Cactus(); cactus.x = 2048 + 100; // spawn just off right edge cactus.y = GROUND_Y; cactus.lastX = cactus.x; // Apply speed multiplier to cactus cactus.speed = cactus.speed * speedMultiplier; game.addChild(cactus); cacti.push(cactus); // Calculate minimum jump window: time to complete a jump (up, hover, down) // Estimate: jump up (abs(cat.jumpVelocity)/cat.gravity), hover (6 ticks), fall (same as up) // Total jump time in ticks var jumpUpTicks = Math.ceil(Math.abs(cat.jumpVelocity) / cat.gravity); var hoverTicks = 6; var jumpTotalTicks = jumpUpTicks + hoverTicks + jumpUpTicks; // Calculate cactus travel time from spawn to cat.x var cactusTravelDistance = 2048 + 100 - CAT_START_X; var avgCactusSpeed = (7 + 8.5) / 2 * speedMultiplier; // average speed, adjusted by multiplier if (avgCactusSpeed < 1) avgCactusSpeed = 1; // avoid divide by zero var cactusTravelTicks = cactusTravelDistance / avgCactusSpeed; // Minimum interval: enough time for cat to land and jump again before next cactus arrives // Add a small buffer (e.g. 10 ticks) var minInterval = Math.max(jumpTotalTicks + 10, 20); // Randomize interval, but always >= minInterval var spawnInterval = minInterval + Math.floor(Math.random() * 30); // Clamp to a minimum of 10 ticks for extreme speeds if (spawnInterval < 10) spawnInterval = 10; nextCactusTick = Math.floor(spawnInterval); } else { nextCactusTick--; } // Update cacti, check for collision and scoring for (var i = cacti.length - 1; i >= 0; i--) { var cactus = cacti[i]; cactus.update(); // Remove if off screen if (cactus.x < -200) { cactus.destroy(); cacti.splice(i, 1); continue; } // Collision detection (only trigger on first intersect) if (!cactus.lastWasIntersecting && cat.intersects(cactus)) { // Game over LK.effects.flashScreen(0xff0000, 800); LK.showGameOver(); gameOver = true; return; } // Scoring: passed cactus (cat.x > cactus.x + cactus.width/2) and not already scored if (!cactus.scored && cat.x > cactus.x + cactus.width / 2) { score++; scoreTxt.setText(score); cactus.scored = true; // Increase speed multiplier, capped at max speedMultiplier += SPEED_MULTIPLIER_INCREMENT; if (speedMultiplier > SPEED_MULTIPLIER_MAX) speedMultiplier = SPEED_MULTIPLIER_MAX; } cactus.lastWasIntersecting = cat.intersects(cactus); } };
===================================================================
--- original.js
+++ change.js
@@ -33,8 +33,11 @@
self.x = 0;
self.vy = 0;
self.isJumping = false;
self.groundY = 0; // will be set after creation
+ // Double jump state
+ self.jumpCount = 0;
+ self.maxJumps = 2;
// Jump parameters
self.jumpVelocity = -65;
self.gravity = 4;
// Update method for physics
@@ -69,42 +72,25 @@
self.vy = 0;
self.isJumping = false;
self.isHovering = false;
self.hasHovered = false;
+ self.jumpCount = 0; // Reset jump count on landing
}
}
};
// Jump method
self.jump = function () {
- if (!self.isJumping) {
+ if (self.jumpCount < self.maxJumps) {
self.isJumping = true;
self.vy = self.jumpVelocity;
self.isHovering = false;
self.hasHovered = false;
self.hoverStartTick = 0;
+ self.jumpCount++;
}
};
return self;
});
-// Ghost class: moves down from above, destroys itself off screen
-var Ghost = Container.expand(function () {
- var self = Container.call(this);
- // Attach ghost asset, anchor center
- var ghostSprite = self.attachAsset('ghost', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 10 + Math.random() * 3;
- self.update = function () {
- self.y += self.speed;
- // Destroy if off screen
- if (self.lastY <= 2800 && self.y > 2800) {
- self.destroy();
- }
- self.lastY = self.y;
- };
- return self;
-});
/****
* Initialize Game
****/
@@ -157,51 +143,8 @@
game.update = function () {
if (gameOver) return;
// Update cat
cat.update();
- // --- GHOST LOGIC ---
- if (typeof ghosts === "undefined") {
- ghosts = [];
- nextGhostTick = Math.floor(120 + Math.random() * 120);
- }
- if (typeof nextGhostTick === "undefined") nextGhostTick = Math.floor(120 + Math.random() * 120);
- // Spawn ghost
- if (nextGhostTick <= 0) {
- var ghost = new Ghost();
- // Spawn ghost at random X above the screen
- ghost.x = 900 + Math.random() * 800;
- ghost.y = -100;
- ghost.lastY = ghost.y;
- game.addChild(ghost);
- ghosts.push(ghost);
- // Next ghost in 2-4 seconds (randomized, faster with speedMultiplier)
- var minGhostInterval = Math.floor(120 / speedMultiplier);
- var maxGhostInterval = Math.floor(240 / speedMultiplier);
- if (minGhostInterval < 30) minGhostInterval = 30;
- if (maxGhostInterval < 60) maxGhostInterval = 60;
- nextGhostTick = minGhostInterval + Math.floor(Math.random() * (maxGhostInterval - minGhostInterval));
- } else {
- nextGhostTick--;
- }
- // Update ghosts, check for collision
- for (var gi = ghosts.length - 1; gi >= 0; gi--) {
- var ghost = ghosts[gi];
- ghost.update();
- // Remove if off screen
- if (ghost.y > 2800) {
- ghost.destroy();
- ghosts.splice(gi, 1);
- continue;
- }
- // Collision detection (only trigger on first intersect)
- if (!ghost.lastWasIntersecting && cat.intersects(ghost)) {
- LK.effects.flashScreen(0x00ffff, 800);
- LK.showGameOver();
- gameOver = true;
- return;
- }
- ghost.lastWasIntersecting = cat.intersects(ghost);
- }
// Spawn cactus
if (nextCactusTick <= 0) {
var cactus = new Cactus();
cactus.x = 2048 + 100; // spawn just off right edge