User prompt
karşıya atlarken biraz çaprazlamasına atlasın, gri alanları kaldır
User prompt
gri kısımı düzeltir misin gidip gidip geliyor bug var gibi, oyunu hızlandır
User prompt
baştan yapar mısın olmadı
User prompt
yandaki duvarlar sürekli aşağıya aksın hiç kesilmesin üstlerinde engeller olsun
User prompt
duvarlar sonsuz loop şeklinde aşağıya aksan bitmesin
User prompt
karakter sabit olsun, sağ sol duvar arasında birbirine atlasın, duvarlara yapışık engeller aşağıya aksın
User prompt
baştan yapar mısın ya olmadı oyun
User prompt
ana karakter aşağıdan yukarıya gidecek, engeller yukarıdan aşağıya akacak, ortadaki objeler rastgele dizilecekler
Code edit (1 edits merged)
Please save this source code
User prompt
Wall Jump Climber
Initial prompt
iki duvar var dikine, yukarı doğru tırmanıyoruz, karşına engeller çıkıyor sen tap yaparak karşıki duvara atlıyorsun oyun git gide hızlanıyor, en uzak mesafeye gitmeye çalışıyoruz skorumuz metre/kilometre cinsinden hesaplanıyor, bir yandan ortada rastgele sarı objeler var onları alınca ek puan kazanıyorsun mesafeye
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Bonus class var Bonus = Container.expand(function () { var self = Container.call(this); var bonusGfx = self.attachAsset('bonus', { anchorX: 0.5, anchorY: 0.5 }); // Update: move down (relative to world) self.update = function (speed) { self.y += speed; }; return self; }); // Climber (player) class var Climber = Container.expand(function () { var self = Container.call(this); var climberGfx = self.attachAsset('climber', { anchorX: 0.5, anchorY: 0.5 }); // State: which wall (0 = left, 1 = right) self.wallSide = 0; // Vertical speed (pixels per tick) self.vy = 10; // Horizontal jump speed (pixels per tick) self.vx = 0; // Is currently jumping self.isJumping = false; // Target wall x self.targetX = 0; // Jump to the other wall self.jump = function () { if (self.isJumping) return; self.wallSide = 1 - self.wallSide; self.isJumping = true; // Set target x self.targetX = self.wallSide === 0 ? wallLeftX + wallWidth / 2 + climberWidth / 2 : wallRightX - wallWidth / 2 - climberWidth / 2; // Add a diagonal jump: also move y a bit up, then back to fixed y var jumpPeakY = self.y - 180; // jump up by 180px var originalY = self.y; // Animate jump with tween (diagonal) tween(self, { x: self.targetX, y: jumpPeakY }, { duration: 90, easing: tween.cubicOut, onFinish: function onFinish() { // Fall back to original y tween(self, { y: originalY }, { duration: 90, easing: tween.cubicIn, onFinish: function onFinish() { self.x = self.targetX; self.isJumping = false; } }); } }); }; // Update: move up self.update = function () { self.y -= self.vy; }; return self; }); // Obstacle class var Obstacle = Container.expand(function () { var self = Container.call(this); var obsGfx = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); // Update: move down (relative to world) self.update = function (speed) { self.y += speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222244 }); /**** * Game Code ****/ // --- Constants --- var wallWidth = 180; var climberWidth = 120; var climberHeight = 120; var wallGap = 2048 - wallWidth * 2; var wallLeftX = wallWidth / 2; var wallRightX = 2048 - wallWidth / 2; var playTopMargin = 100; // leave top 100px for menu var playBottomMargin = 0; // --- State --- var climber; var obstacles = []; var bonuses = []; var distance = 0; // in pixels var bonusScore = 0; var scrollSpeed = 18; // initial vertical speed (pixels per tick) - increased for faster game var speedIncreaseEvery = 400; // increase speed more frequently var speedIncreaseAmount = 1.2; // increase speed more per step var maxScrollSpeed = 48; // allow higher max speed var lastObstacleY = 0; var lastBonusY = 0; var obstacleSpacing = 420; // min vertical distance between obstacles var bonusSpacing = 900; // min vertical distance between bonuses var scoreTxt; // --- Walls --- var wallLeft = LK.getAsset('wall', { anchorX: 0.5, anchorY: 0 }); var wallRight = LK.getAsset('wall', { anchorX: 0.5, anchorY: 0 }); wallLeft.x = wallLeftX; wallLeft.y = 0; wallRight.x = wallRightX; wallRight.y = 0; game.addChild(wallLeft); game.addChild(wallRight); // No grey area in the middle, only left/right walls // --- Climber --- climber = new Climber(); climber.x = wallLeftX + wallWidth / 2 + climberWidth / 2; climber.y = 900; // fixed Y on screen game.addChild(climber); // --- Score Display --- scoreTxt = new Text2('0 m', { size: 120, fill: 0xFFF700 }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // --- Helper: format distance --- function formatDistance(px) { var meters = Math.floor(px / 10); if (meters < 1000) return meters + " m"; return (meters / 1000).toFixed(2) + " km"; } // --- Helper: update score text --- function updateScoreText() { var meters = Math.floor(distance / 10); var bonusStr = bonusScore > 0 ? " +" + bonusScore : ""; scoreTxt.setText(meters + " m" + bonusStr); } // --- Helper: spawn obstacle --- function spawnObstacle() { // Randomly pick left or right wall var side = Math.random() < 0.5 ? 0 : 1; var obs = new Obstacle(); obs.x = side === 0 ? wallLeftX + wallWidth / 2 + climberWidth / 2 : wallRightX - wallWidth / 2 - climberWidth / 2; obs.y = lastObstacleY - obstacleSpacing - Math.random() * 220; obstacles.push(obs); game.addChild(obs); lastObstacleY = obs.y; } // --- Helper: spawn bonus --- function spawnBonus() { var bonus = new Bonus(); bonus.x = 2048 / 2; bonus.y = lastBonusY - bonusSpacing - Math.random() * 400; bonuses.push(bonus); game.addChild(bonus); lastBonusY = bonus.y; } // --- Initial obstacles/bonuses --- lastObstacleY = climber.y - 400; lastBonusY = climber.y - 800; for (var i = 0; i < 6; i++) { spawnObstacle(); } for (var i = 0; i < 2; i++) { spawnBonus(); } // --- Input: tap to jump --- game.down = function (x, y, obj) { if (!climber.isJumping) { climber.jump(); } }; // --- Move handler (not used for drag, but required by LK) --- game.move = function (x, y, obj) {}; // --- Main update loop --- game.update = function () { // Increase speed over time if (LK.ticks % speedIncreaseEvery === 0 && scrollSpeed < maxScrollSpeed) { scrollSpeed += speedIncreaseAmount; climber.vy = scrollSpeed; } // Keep climber fixed at a screen Y, move obstacles/bonuses/walls down by scrollSpeed var screenClimberY = 900; // fixed Y position for climber on screen (about 1/3 from bottom) climber.y = screenClimberY; // Move all obstacles and bonuses down by scrollSpeed for (var i = 0; i < obstacles.length; i++) { obstacles[i].y += scrollSpeed; } for (var j = 0; j < bonuses.length; j++) { bonuses[j].y += scrollSpeed; } // Move walls down and loop them infinitely, and keep obstacles on top of walls wallLeft.y += scrollSpeed; wallRight.y += scrollSpeed; // Loop walls if they move out of view, and move obstacles attached to them while (wallLeft.y >= 2732) { wallLeft.y -= 2732; // Move all left wall obstacles up by 2732 if they are attached to this wall for (var i = 0; i < obstacles.length; i++) { if (obstacles[i].x < 2048 / 2) { obstacles[i].y -= 2732; } } } while (wallRight.y >= 2732) { wallRight.y -= 2732; // Move all right wall obstacles up by 2732 if they are attached to this wall for (var i = 0; i < obstacles.length; i++) { if (obstacles[i].x > 2048 / 2) { obstacles[i].y -= 2732; } } } // Update distance distance += scrollSpeed; updateScoreText(); // Move obstacles and check collision for (var i = obstacles.length - 1; i >= 0; i--) { var obs = obstacles[i]; // Remove if off screen if (obs.y > 2732 + 100) { obs.destroy(); obstacles.splice(i, 1); continue; } // Collision: only if climber is on same wall if (Math.abs(obs.x - climber.x) < 10 && Math.abs(obs.y - screenClimberY) < climberHeight / 2 + 30) { LK.effects.flashScreen(0xff0000, 800); LK.showGameOver(); return; } } // Move bonuses and check collection for (var j = bonuses.length - 1; j >= 0; j--) { var b = bonuses[j]; // Remove if off screen if (b.y > 2732 + 100) { b.destroy(); bonuses.splice(j, 1); continue; } // Collect if (Math.abs(b.x - climber.x) < 80 && Math.abs(b.y - screenClimberY) < 80) { bonusScore += 10; updateScoreText(); LK.effects.flashObject(b, 0xffff00, 400); b.destroy(); bonuses.splice(j, 1); continue; } } // Spawn new obstacles/bonuses as needed if (lastObstacleY > climber.y - 1200) { spawnObstacle(); } if (lastBonusY > climber.y - 1800) { spawnBonus(); } }; // --- Reset state on game over --- game.on('gameover', function () { // All state will be reset by LK, so nothing to do here }); // --- You win (not used in endless) --- game.on('youwin', function () { // Not used });
===================================================================
--- original.js
+++ change.js
@@ -42,17 +42,30 @@
self.wallSide = 1 - self.wallSide;
self.isJumping = true;
// Set target x
self.targetX = self.wallSide === 0 ? wallLeftX + wallWidth / 2 + climberWidth / 2 : wallRightX - wallWidth / 2 - climberWidth / 2;
- // Animate jump with tween
+ // Add a diagonal jump: also move y a bit up, then back to fixed y
+ var jumpPeakY = self.y - 180; // jump up by 180px
+ var originalY = self.y;
+ // Animate jump with tween (diagonal)
tween(self, {
- x: self.targetX
+ x: self.targetX,
+ y: jumpPeakY
}, {
- duration: 180,
+ duration: 90,
easing: tween.cubicOut,
onFinish: function onFinish() {
- self.x = self.targetX;
- self.isJumping = false;
+ // Fall back to original y
+ tween(self, {
+ y: originalY
+ }, {
+ duration: 90,
+ easing: tween.cubicIn,
+ onFinish: function onFinish() {
+ self.x = self.targetX;
+ self.isJumping = false;
+ }
+ });
}
});
};
// Update: move up
@@ -123,8 +136,9 @@
wallRight.x = wallRightX;
wallRight.y = 0;
game.addChild(wallLeft);
game.addChild(wallRight);
+// No grey area in the middle, only left/right walls
// --- Climber ---
climber = new Climber();
climber.x = wallLeftX + wallWidth / 2 + climberWidth / 2;
climber.y = 900; // fixed Y on screen
make cyberpunk retro, neon wall. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Make pixelart neon wall obstacle. In-Game asset. 2d. High contrast. No shadows
toony basic flame. In-Game asset. 2d. High contrast. No shadows
mavileri parlat daha renkli olsun
arkasına parıltı ekle
kalbi retro neon yap