User prompt
jumpsound sesini her zıplama için ekle
User prompt
enemy hitboxlarını çok az küçült
User prompt
Please fix the bug: 'TypeError: LK.showLeaderboard is not a function. (In 'LK.showLeaderboard()', 'LK.showLeaderboard' is undefined)' in or related to this line: 'LK.showLeaderboard();' Line Number: 165
User prompt
oynayan oyuncuların skorlarını gösteren liderlik tablosu yapabilir misin
User prompt
skor sayacını büyült
User prompt
skor sayacı ekle
User prompt
skor sayacının kaldır koddan
User prompt
skor sayacının boyutu çok küçük büyült
User prompt
skor sayacı gözüksğn
User prompt
skor sayacının fontunu bold yapabilir misin
User prompt
skor sayacını çok az aşağı kaydır
User prompt
skor sayacı yap atladıkları skorlar ekranın üst kısmında gözüksün
User prompt
arka plan sabit dursun knk hareketi kapat
User prompt
arka planı yavaşça sola kaydır ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
oyuncu ne kadar engel zıplarsa say ve final scorea ekle
User prompt
final score ekle ve bu final score oyun bittiğinde yazsın
User prompt
bitiş ekranında oyuncunun kaç engelden zıpladığı yazsın
User prompt
score panel ve kodlarını kaldır
User prompt
score panel ekranda oyuncu atladıkça artsın ve ekranda gözüksün
User prompt
add assets about score
User prompt
Final score ekranda gözüksün
User prompt
prizeı koddan kaldır
User prompt
prize ın konumunu sabit tut
User prompt
prize puan kazandırmasın
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Enemy class var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.83, scaleY: 0.83 }); self.speed = 8; self.passed = false; self.update = function () { self.x -= self.speed; if (self.x < -50) { self.destroy(); } }; self.getHitbox = function () { return { x: self.x - 60, y: self.y - 120, width: 160, height: 240 }; }; }); // Player class var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.95, scaleY: 0.95 }); self.speed = 1000; self.jumpHeight = 30; self.isJumping = false; self.velocityY = 0; self.update = function () { if (self.isJumping) { self.y += self.velocityY; self.velocityY += 0.7; if (self.y >= 2732 / 2) { self.y = 2732 / 2; self.isJumping = false; self.velocityY = 0; } } }; self.jump = function () { if (!self.isJumping) { self.isJumping = true; self.velocityY = -self.jumpHeight; LK.getSound('jumpsound').play(); } }; self.getHitbox = function () { return { x: self.x - 75, y: self.y - 150, width: 150, height: 300 }; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Import tween plugin for smooth animations // Background var background = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 })); // Create a duplicate background for seamless scrolling var background2 = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2 + background.width, y: 2732 / 2 })); // Background scrolling animation is now disabled function scrollBackground() { // Background remains static - no scrolling animation } // Not starting the scrolling animation anymore // Player var player = game.addChild(new Player()); player.x = 2048 / 2 - 100; player.y = 2732 / 2; // Enemy array var enemies = []; var enemySpawnInterval = 100; var enemySpawnCounter = 0; // Score Text var scoreText = new Text2('0', { size: 100, fill: 0xFFFFFF }); LK.gui.top.addChild(scoreText); // Center the score text horizontally, anchor point set at the middle of its top edge. scoreText.anchor.set(0.5, 0); scoreText.x = LK.gui.top.width / 2; scoreText.y = 40; // Collision function function checkCollision(rect1, rect2) { return rect1.x < rect2.x + rect2.width && rect1.x + rect1.width > rect2.x && rect1.y < rect2.y + rect2.height && rect1.y + rect1.height > rect2.y; } // Spawn Enemy function spawnEnemy() { var enemy = new Enemy(); enemy.x = 2048; enemy.y = 2732 / 2; enemy.passed = false; enemies.push(enemy); game.addChild(enemy); } // Game loop game.update = function () { player.update(); // Enemy spawn enemySpawnCounter++; if (enemySpawnCounter >= enemySpawnInterval) { spawnEnemy(); enemySpawnInterval = Math.floor(Math.random() * 100) + 50; enemySpawnCounter = 0; } // Update enemies for (var j = enemies.length - 1; j >= 0; j--) { enemies[j].update(); // Collision detection if (checkCollision(player.getHitbox(), enemies[j].getHitbox())) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); LK.stopMusic(); LK.playMusic('Music'); // Leaderboard will be shown automatically by LK after game over } // Score increment else if (enemies[j].x < player.x && !enemies[j].passed) { enemies[j].passed = true; LK.setScore(LK.getScore() + 1); scoreText.setText(LK.getScore()); } // Remove offscreen enemy if (enemies[j].x < -50) { enemies[j].destroy(); enemies.splice(j, 1); } } // Speed increase if (LK.ticks % 300 == 0) { for (var i = 0; i < enemies.length; i++) { enemies[i].speed += 1; } } }; // Tap to jump game.down = function (x, y, obj) { player.jump(); }; // Music LK.playMusic('Music');
===================================================================
--- original.js
+++ change.js
@@ -59,8 +59,9 @@
self.jump = function () {
if (!self.isJumping) {
self.isJumping = true;
self.velocityY = -self.jumpHeight;
+ LK.getSound('jumpsound').play();
}
};
self.getHitbox = function () {
return {
@@ -81,10 +82,10 @@
/****
* Game Code
****/
-// Background
// Import tween plugin for smooth animations
+// Background
var background = game.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,