User prompt
Karakterimiz her saniye 12 birim sola kayar
User prompt
Karakterimiz her saniye 7 birim sola kayar
User prompt
Oyuncu adlı görsel oyuna eklendikten sonra her saniye 7 birim sola kayar
User prompt
Oyuncu adlı görsel her saniye 7 birim sola kayar
User prompt
Karakterimiz puan 9 olduktan sonra orta kısmın sağına geçebilir
User prompt
Karakterimiz sahnede istediği yere gidebilir
User prompt
Oyuncu adlı görsel karakterimizin yaptığı hamleyi 1 saniye sonra taklit eder
User prompt
Eğer düşman oyuncu adlı görseli algılarsa oyuncu adlı görsel oyundan kaldırılır
User prompt
Oyuncu adlı görsel karakterimize 10 birim yakınına yaklaşamaz
User prompt
Oyuncu adlı görselin hızını arttır
User prompt
Oyuncu sahneye ekledikten sonra karakterimizle aynı özelliklere sahip olur fakat karakterimize 10 birim uzakta durmak zorundadır
User prompt
Oyuncu adlı görsel puan 9 olduktan sonra oyuna eklenir
User prompt
Oyuncu adlı görsel karakterimizle aynı hareket özelliklerine sahiptir
User prompt
Oyuncu adlı görsel her hamlede yukarı doğru hareket eder
User prompt
Puan 9 ve 9 un katları olunca arkaplanın sol alt köşesine kaybedene kadar duracak şekilde oyuncu adlı görseli koy
User prompt
Puan 9 ve 9 un katları olunca arkaplanın sol alt köşesine oyuncu adlı görseli koy
User prompt
Puan 10 olunca Sahnenin sol alt köşesinde oyuncu adlı görseli yerleştir
User prompt
Puan 9 olduğunda 0 dan tekrar başla
User prompt
Puan arttıkça sonsuz döngü şeklinde bittikçe 1 den başla
User prompt
Sayı görselleri bitince baştan başla
User prompt
oyuncu adlı görsel x ve y doğrusunda karakterimizle aynı hareketi otomatik şekilde yapar
User prompt
Oyuncu adlı görsel karakterimizi takip eder
User prompt
Oyuncu adlı görsel puan 9 olduktan sonra kalıcı şekilde sahnede kalır
User prompt
Cicek adlı görseli kaldır
User prompt
Puan 9 ve 9 un katları olduğunda sahnenin sağ alt köşesine 'oyuncu' adlı görsel eklenir
/**** * Plugins ****/ var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ // Define a class for enemies var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { self.x -= self.speed; self.y += Math.sin(self.x / 100) * 10; if (self.x < -50) { self.destroy(); } }; }); //<Assets used in the game will automatically appear here> // Define a class for the player character var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.jumpHeight = 20; self.isJumping = false; self.velocityY = 0; self.update = function () { if (self.isJumping) { self.y += self.velocityY; self.velocityY += 0.7; // Decreased gravity effect by 30% if (self.y >= 2732 / 2) { // Ground level self.y = 2732 / 2; self.isJumping = false; self.velocityY = 0; } } // Move the player diagonally to the middle of the stage in the first move if (self.x < 2048 / 2 && self.y < 2732 / 2) { self.x += self.speed; self.y += self.speed; } else if (!self.isJumping) { if (self.x > 30) { self.x -= 4; } } // Prevent the player from leaving the stage if (self.x < 0) { self.x = 0; } else if (self.x > 2048 - self.width) { self.x = 2048 - self.width; } if (self.y < 0) { self.y = 0; } else if (self.y > 2732 - self.height) { self.y = 2732 - self.height; } }; self.jump = function () { self.isJumping = true; self.velocityY = -self.jumpHeight; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Sky blue background }); /**** * Game Code ****/ // Initialize background var background = game.addChild(LK.getAsset('arkplan', { anchorX: 0.0, anchorY: 0.0, scaleX: 2048 / 100, scaleY: 2732 / 100, x: 0, y: 0 })); // Initialize player var player = game.addChild(new Player()); player.x = 200; player.y = 2732 - player.height - 150; // Add a delay of 2 seconds before the game starts LK.setTimeout(function () { // Make the first jump move automatically player.jump(); }, 2000); // Initialize enemies var enemies = []; var enemySpawnInterval = 100; var enemySpawnCounter = 0; // Load score from storage or initialize to 0 var currentScore = storage.score || 0; // Create a new Text2 object to display the score var scoreText = new Text2(currentScore.toString(), { size: 100, fill: 0xFFFFFF }); // Add the score text to the game GUI at the top right of the screen LK.gui.topRight.addChild(scoreText); scoreText.x = 2048 - 50; // 50 pixels from the right edge scoreText.y = 0; // Handle game updates game.update = function () { player.update(); // Spawn enemies enemySpawnCounter++; if (enemySpawnCounter >= enemySpawnInterval) { var enemy = new Enemy(); enemy.x = 2048; enemy.y = Math.random() * (2732 / 2); enemies.push(enemy); game.addChild(enemy); // Decrease the spawn interval for the next enemy every 10 seconds if (LK.ticks % 600 == 0 && enemySpawnInterval > 10) { enemySpawnInterval -= 10; } enemySpawnCounter = 0; } // Update enemies for (var j = enemies.length - 1; j >= 0; j--) { enemies[j].update(); if (player.intersects(enemies[j]) && Math.abs(player.x - enemies[j].x) < 50 && Math.abs(player.y - enemies[j].y) < 50) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } else if (player.x > enemies[j].x && !enemies[j].passed) { enemies[j].passed = true; LK.setScore(LK.getScore() + 1); var currentScore = LK.getScore(); storage.score = currentScore; // Save score to storage var scoreAssetId = 'Skor' + currentScore % 10; if (currentScore % 9 === 0) { var cicekAsset = game.addChild(LK.getAsset('cicek', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 })); LK.setTimeout(function () { cicekAsset.destroy(); }, 1000); // Add 'oyuncu' image to the bottom-right corner var oyuncuAsset = game.addChild(LK.getAsset('Oyuncu', { anchorX: 1.0, anchorY: 1.0, x: 2048, y: 2732 })); LK.setTimeout(function () { oyuncuAsset.destroy(); }, 1000); } if (currentScore <= 9) { game.children.forEach(function (child) { if (child.assetId && child.assetId.startsWith('Skor')) { child.destroy(); } }); var scoreAsset = game.addChild(LK.getAsset(scoreAssetId, { anchorX: 0.5, anchorY: 1.0, x: 2048 / 2, y: 2732 })); LK.setTimeout(function () { scoreAsset.destroy(); }, 1000); } else { scoreText.setText(currentScore); } } } }; // Handle player jump game.down = function (x, y, obj) { player.jump(); };
===================================================================
--- original.js
+++ change.js
@@ -143,29 +143,29 @@
enemies[j].passed = true;
LK.setScore(LK.getScore() + 1);
var currentScore = LK.getScore();
storage.score = currentScore; // Save score to storage
- var scoreAssetId = 'Skor' + currentScore;
+ var scoreAssetId = 'Skor' + currentScore % 10;
if (currentScore % 9 === 0) {
- // Add 'oyuncu' image to the bottom-right corner if not already added
- if (!game.oyuncuAdded) {
- var oyuncu = LK.getAsset('Oyuncu', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: player.x,
- y: player.y
- });
- game.addChild(oyuncu);
- game.oyuncuAdded = true;
- game.oyuncu = oyuncu;
- } else {
- game.oyuncu.x = player.x;
- game.oyuncu.y = player.y;
- game.oyuncu.lastX = game.oyuncu.x;
- game.oyuncu.lastY = game.oyuncu.y;
- game.oyuncu.lastX = game.oyuncu.x;
- game.oyuncu.lastY = game.oyuncu.y;
- }
+ var cicekAsset = game.addChild(LK.getAsset('cicek', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 2048 / 2,
+ y: 2732 / 2
+ }));
+ LK.setTimeout(function () {
+ cicekAsset.destroy();
+ }, 1000);
+ // Add 'oyuncu' image to the bottom-right corner
+ var oyuncuAsset = game.addChild(LK.getAsset('Oyuncu', {
+ anchorX: 1.0,
+ anchorY: 1.0,
+ x: 2048,
+ y: 2732
+ }));
+ LK.setTimeout(function () {
+ oyuncuAsset.destroy();
+ }, 1000);
}
if (currentScore <= 9) {
game.children.forEach(function (child) {
if (child.assetId && child.assetId.startsWith('Skor')) {