User prompt
bir yazi ekle text game overin uzerine ve yazi getor yazilsin
Code edit (1 edits merged)
Please save this source code
User prompt
if (player.intersects(enemy)) { LK.showGameOver(); LK.getSound('gamop').play(); if (score > highScore) { highScore = score; } scoreText.setText('Score: ' + score + '\nHigh Score: ' + highScore); scoreText.x = 2048 / 2; scoreText.y = 2732 / 2 + 200; // Ekranın ortasında göstermek için }
User prompt
game.down = function (x, y, obj) { player.jump(); for (var i = 0; i < enemies.length; i++) { var enemy = enemies[i]; var passedEnemy = player.y < enemy.y && player.x > enemy.x && player.x < enemy.x + enemy.width; if (passedEnemy) { score++; scoreText.setText('Score: ' + score); break; } } }; bunu ekle bakalim
User prompt
Honey, listen to me carefully. In games like Subway Surf or other games like Flabbybird etc., when we come to the Gameover screen, our score is shown. Please do that, do it properly.
User prompt
bu oyuna skor ekle artik
User prompt
ilk bastaki skor sistemin geri koy yerine
User prompt
halada gozukuyor duzmanin uzerinden her zipladimizda scoremiz 1 kere artsin
User prompt
benim oyunuma koymani istedim ama koymuyorsun bu oyuna koy o sistemi
User prompt
halada gozukmuyor
User prompt
skorumuz game overin altinde gozuksun
User prompt
hight score ekle ya
User prompt
scoremiz her dusmanin uzerinden atladimizda 1 artsin tm mi
User prompt
scor koy oyuna oyun bitdinde skorumuz gozyuksun mesala score=1
User prompt
kirmiz renkde textle yazilsiz skorumuzu
User prompt
halada gozukmuyo skorumuz text seklinde gozuksun olay again tusunun uzerinde
User prompt
onu bos ver skorumuz game over ekraninda gozuksun kac tane ennemyin uzerinden zepladik gozuksun
User prompt
dusmanlar bize deydiyiyinde gamop sesi calsin
User prompt
game over ekrani geldiyinde calsin
User prompt
didi muziyini oyuna koy sonsuz devam etsin
User prompt
ekranda gozuksun yada game over ekraninda
User prompt
hey score sayacin eklememisin scoremiz gorunmuyo
User prompt
Let's have a score counter, put a text under the pause button, score = 0 and every time we jump over the smoke, the 0 in our score will become +1 and it will appear.
User prompt
ve bu game over ekraninda play again tusunun uzerinde scorumuz gozukucek
User prompt
enemmyler playere deydinde game over ekranina aticak
/**** * Classes ****/ 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; }; }); 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 = 40; self.isJumping = false; self.velocityY = 0; self.update = function () { // Yerçekimi self.velocityY += 0.8; self.y += self.velocityY; if (self.y > ground.y - self.height) { self.y = ground.y - self.height; self.velocityY = 0; self.isJumping = false; } }; self.jump = function () { if (!self.isJumping) { self.isJumping = true; self.velocityY = -self.jumpHeight; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB, width: 8192, height: 10928 }); /**** * Game Code ****/ var background = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, width: game.width, height: game.height })); background.x = game.width / 2; background.y = game.height / 2; LK.playMusic('didi', { loop: true }); var ground = game.addChild(LK.getAsset('ground', { anchorX: 0, anchorY: 1 })); ground.x = 0; ground.y = 2732 - 300; // Oyuncu var player = game.addChild(new Player()); player.x = 2048 / 2; player.y = ground.y - player.height - 420; // Düşmanlar var enemies = []; var enemySpawnInterval = 100; var enemySpawnCounter = 0; // Skorlar var score = 0; var highScore = 0; // Skor metni var scoreText = new Text2('Score: 0', { size: 100, fill: 0xFF0000 }); LK.gui.top.addChild(scoreText); scoreText.x = 2048 / 2; scoreText.y = 100; // Oyun güncellemesi game.update = function () { player.update(); // Düşman üretme enemySpawnCounter++; if (enemySpawnCounter >= enemySpawnInterval) { var enemy = new Enemy(); enemy.x = game.width; enemy.y = ground.y - enemy.height; enemies.push(enemy); game.addChild(enemy); enemySpawnInterval = Math.floor(Math.random() * 150) + 50; enemySpawnCounter = 0; } // Düşman güncelleme ve çarpışma kontrolü for (var i = 0; i < enemies.length; i++) { var enemy = enemies[i]; enemy.update(); if (player.intersects(enemy)) { LK.showGameOver(); LK.getSound('gamop').play(); if (score > highScore) { highScore = score; } scoreText.setText('Score: ' + score + '\nHigh Score: ' + highScore); scoreText.x = 2048 / 2; scoreText.y = 2732 / 2 + 200; } } }; // Oyuncu zıplarsa puan kazanma game.down = function (x, y, obj) { player.jump(); for (var i = 0; i < enemies.length; i++) { var enemy = enemies[i]; if (player.y < enemy.y && player.x > enemy.x && player.x < enemy.x + enemy.width) { score++; scoreText.setText('Score: ' + score); break; } } };
===================================================================
--- original.js
+++ change.js
@@ -1,8 +1,7 @@
/****
* Classes
****/
-// Define a class for enemies
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
@@ -12,10 +11,8 @@
self.update = function () {
self.x -= self.speed;
};
});
-//<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,
@@ -25,12 +22,11 @@
self.jumpHeight = 40;
self.isJumping = false;
self.velocityY = 0;
self.update = function () {
- // Apply gravity
+ // Yerçekimi
self.velocityY += 0.8;
self.y += self.velocityY;
- // Prevent the player from falling below the ground
if (self.y > ground.y - self.height) {
self.y = ground.y - self.height;
self.velocityY = 0;
self.isJumping = false;
@@ -41,16 +37,16 @@
self.isJumping = true;
self.velocityY = -self.jumpHeight;
}
};
+ return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB,
- // Sky blue background
width: 8192,
height: 10928
});
@@ -64,109 +60,74 @@
height: game.height
}));
background.x = game.width / 2;
background.y = game.height / 2;
-// Play the music in a loop
LK.playMusic('didi', {
loop: true
});
-// Create a ground asset and add it to the game
var ground = game.addChild(LK.getAsset('ground', {
anchorX: 0,
anchorY: 1
}));
ground.x = 0;
-ground.y = 2732 - 300; // Move the ground a bit upwards
-// Initialize player
+ground.y = 2732 - 300;
+// Oyuncu
var player = game.addChild(new Player());
player.x = 2048 / 2;
player.y = ground.y - player.height - 420;
-// Initialize enemies
+// Düşmanlar
var enemies = [];
var enemySpawnInterval = 100;
var enemySpawnCounter = 0;
-// Initialize score and highScore
+// Skorlar
var score = 0;
var highScore = 0;
-// Create a new Text2 object to display the score
-var scoreText = new Text2('0', {
+// Skor metni
+var scoreText = new Text2('Score: 0', {
size: 100,
fill: 0xFF0000
});
-// Add the score text to the game GUI under the pause button
LK.gui.top.addChild(scoreText);
scoreText.x = 2048 / 2;
scoreText.y = 100;
-// Initialize score and highScore
-var score = 0;
-var highScore = 0;
-// Handle game updates
+// Oyun güncellemesi
game.update = function () {
player.update();
- // Spawn enemies
+ // Düşman üretme
enemySpawnCounter++;
if (enemySpawnCounter >= enemySpawnInterval) {
var enemy = new Enemy();
- // Set the spawn position for the enemy to be the same as the ground's y position
enemy.x = game.width;
enemy.y = ground.y - enemy.height;
enemies.push(enemy);
game.addChild(enemy);
- // Randomize the spawn interval for the next enemy
enemySpawnInterval = Math.floor(Math.random() * 150) + 50;
enemySpawnCounter = 0;
}
- // Update enemies
+ // Düşman güncelleme ve çarpışma kontrolü
for (var i = 0; i < enemies.length; i++) {
var enemy = enemies[i];
enemy.update();
- // Check if player intersects with enemy
if (player.intersects(enemy)) {
- // Show game over screen
LK.showGameOver();
- // Play the 'gamop' sound
LK.getSound('gamop').play();
- // Update highScore if score is higher
if (score > highScore) {
highScore = score;
}
- // Show score and highScore on game over screen
scoreText.setText('Score: ' + score + '\nHigh Score: ' + highScore);
+ scoreText.x = 2048 / 2;
+ scoreText.y = 2732 / 2 + 200;
}
}
- // Show score and highScore on game over screen
- scoreText.setText('Score: ' + score + '\nHigh Score: ' + highScore);
- scoreText.x = 2048 / 2;
- scoreText.y = 2732 / 2 + 200; // Position the score text below the game over screen
- LK.gui.top.addChild(scoreText);
};
-// Handle player jump
+// Oyuncu zıplarsa puan kazanma
game.down = function (x, y, obj) {
player.jump();
for (var i = 0; i < enemies.length; i++) {
var enemy = enemies[i];
- var passedEnemy = player.y < enemy.y && player.x > enemy.x && player.x < enemy.x + enemy.width;
- if (passedEnemy) {
+ if (player.y < enemy.y && player.x > enemy.x && player.x < enemy.x + enemy.width) {
score++;
scoreText.setText('Score: ' + score);
break;
}
}
- // Increase score by 1 if player jumps over an enemy
- for (var i = 0; i < enemies.length; i++) {
- var enemy = enemies[i];
- if (player.y < enemy.y && player.x > enemy.x && player.x < enemy.x + enemy.width) {
- score++;
- scoreText.setText('Score: ' + score); // Update the score text
- break;
- }
- }
- // Increase score by 1 if player jumps over an enemy
- for (var i = 0; i < enemies.length; i++) {
- var enemy = enemies[i];
- if (player.y < enemy.y && player.x > enemy.x && player.x < enemy.x + enemy.width) {
- score++;
- scoreText.setText('Score: ' + score); // Update the score text
- break;
- }
- }
};
\ No newline at end of file
guzel 2d bir arka plan bulutlu havalar arkada ucan kuslar ve bu 2d olucak. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. 2d
yuzu olan kizqin bir ates topu sinirli yakici ve pixelart. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows