User prompt
taş asseti ekle ve bu asset de target asseti gibi yukardan aşağı gelsin
User prompt
yukarı atılan mermi eger herhangi bir hedefe carpmazsa skor 2 eksilir
User prompt
skor 100 den sonra 50 nin katlarında 3 saniye süre eklensin
User prompt
skor 0 dan başlasın
User prompt
oyunun en başında sadece bir tane target olmasın
User prompt
oyunun en başında targetların hepsi ekranın orta kısmından aşağı düşmeye başlasın
User prompt
music assetinin volume ünü 40 a sebitle
User prompt
oyun bittiğnde müziği de bitir
User prompt
skor 0 ın altına düşemez
User prompt
bullet 0 sıfır olursa da oyun biter
User prompt
eger sarkı bıtmeden oyun biterse ve oyuncu yeniden oynamak isterse şarkıyı baştan başlat
User prompt
Please fix the bug: 'TypeError: LK.getMusic is not a function' in or related to this line: 'if (LK.ticks === 0 || LK.getMusic('ab').ended && bulletCount !== 0 && timer !== 0) {' Line Number: 195
User prompt
eğer oyun bitmedıgı halde sarkının suresı bıterse sarkıyı bastan calmaya devam et
User prompt
ab music assetini ouyun baslayınca calmaya basla
User prompt
music assetini kaldır
User prompt
ab music assetini oyun başladığı anda çalmaya başla
User prompt
ilk mermi atıldıktan sonra music ab calmaya baslasın
User prompt
ab music assetini ekle
User prompt
arda sound unu bullet target hedefine carptıgında ver
User prompt
gun assetini ekrandan kaldır
User prompt
sadece gun assetine bastıgında mermi cıksın
User prompt
gun assetini ekranın alt kısmına yerlestır
User prompt
bullet assetinin cıkacagı yeni bır asset istiyorum
User prompt
skor ekranın üst ortasına yakın bşir konumda olsun
User prompt
skor 1 cm kadar sol tarafta olsun
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Bullet class representing the bullets fired by the player
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -10;
self.update = function () {
self.y += self.speed;
};
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Target class representing the targets to be hit
var Target = Container.expand(function () {
var self = Container.call(this);
var targetGraphics = self.attachAsset('target', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 1;
self.update = function () {
self.y += self.speed;
if (self.y > 2732) {
self.y = -targetGraphics.height;
self.x = Math.random() * 2048;
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize variables
var score = 0;
var bullets = [];
var targets = [];
var bulletCount = 5; // Initialize bullet count to 5
// Add the background asset to the game
var background = game.attachAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
var scoreTxt = new Text2('0', {
size: 150,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Display bullet count
var bulletCountTxt = new Text2('Bullets: ' + bulletCount, {
size: 100,
fill: 0xFFFFFF
});
bulletCountTxt.anchor.set(1, 1); // Anchor to bottom right
LK.gui.bottomRight.addChild(bulletCountTxt);
// Initialize timer
var timer = 30;
var timerTxt = new Text2('Time: ' + timer, {
size: 100,
fill: 0xFFFFFF
});
timerTxt.anchor.set(1, 0); // Anchor to top right
LK.gui.topRight.addChild(timerTxt);
// Update timer every second
LK.setInterval(function () {
timer--;
timerTxt.setText('Time: ' + timer);
}, 1000);
// Create targets
for (var i = 0; i < 5; i++) {
var target = new Target();
target.x = 2048 / 2;
target.y = 2732 / 2;
targets.push(target);
game.addChild(target);
}
// Handle shooting
var bulletCount = 5; // Initialize bullet count to 5
game.down = function (x, y, obj) {
if (bulletCount > 0 && y > 2732 / 2) {
// Check if bullet count is greater than 0 and the touch event is in the bottom half of the screen before firing
var newBullet = new Bullet();
newBullet.x = x;
newBullet.y = 2732; // Bullets start from the bottom of the screen
bullets.push(newBullet);
game.addChild(newBullet);
bulletCount--; // Decrease bullet count by 1 each time a bullet is fired
bulletCountTxt.setText('Bullets: ' + bulletCount); // Update bullet count display
// Play 'ab' music when the first bullet is fired
if (bullets.length === 1) {
LK.stopMusic();
LK.playMusic('ab');
}
}
};
// Update game state
game.update = function () {
for (var i = bullets.length - 1; i >= 0; i--) {
bullets[i].update();
if (bullets[i].y < -50) {
bullets[i].destroy();
bullets.splice(i, 1);
} else if (bullets[i].y >= 2732) {
bulletCount -= 4; // Decrease bullet count by 4
bulletCountTxt.setText('Bullets: ' + bulletCount); // Update bullet count display
bullets[i].destroy();
bullets.splice(i, 1);
}
}
for (var j = targets.length - 1; j >= 0; j--) {
targets[j].update();
for (var k = bullets.length - 1; k >= 0; k--) {
if (bullets[k].intersects(targets[j])) {
score += 1;
scoreTxt.setText(score);
targets[j].y = -targets[j].height;
targets[j].x = Math.random() * 2048;
targets[j].speed += 0.5; // Decrease the speed of the target
bulletCount += 2; // Increase bullet count by 2 when a bullet hits a target
LK.getSound('arda').play(); // Play 'arda' sound
// Check if the score is a multiple of 50 and score is greater than 200
if (score % 50 === 0 && score > 200) {
timer += 4; // Add 4 seconds to the timer
timerTxt.setText('Time: ' + timer); // Update timer display
} else if (score % 25 === 0) {
bulletCount += 5; // Add 5 bullets to the current bullet count
// If score is greater than 125, add 6 seconds to the timer, else add 10 seconds
timer += score > 125 ? 6 : 10;
timerTxt.setText('Time: ' + timer); // Update timer display
}
bulletCountTxt.setText('Bullets: ' + bulletCount); // Update bullet count display
LK.effects.flashObject(targets[j], 0xff0000, 500); // Add explosion effect
// Add light effect at the location where the bullet hits the target
var lightEffect = LK.getAsset('light', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.1,
scaleY: 0.1,
alpha: 0.8
});
lightEffect.x = bullets[k].x; // Position of the bullet
lightEffect.y = bullets[k].y; // Position of the bullet
game.addChild(lightEffect);
tween(lightEffect, {
scaleX: 1,
scaleY: 1,
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
lightEffect.destroy();
}
});
}
}
if (targets[j].y >= 2732) {
score = Math.max(0, score - 3); // Decrease score by 3 but not below 0
scoreTxt.setText(score); // Update score display
targets[j].y = -targets[j].height;
targets[j].x = Math.random() * 2048;
}
}
// Check if bullet count is 0 or timer is 0, if so, end the game
if (bulletCount <= 0 || timer === 0) {
LK.stopMusic();
LK.showGameOver();
}
if (LK.ticks === 0 || LK.getSound('ab').ended && bulletCount !== 0 && timer !== 0) {
LK.playMusic('ab');
}
}; ===================================================================
--- original.js
+++ change.js
@@ -87,10 +87,10 @@
}, 1000);
// Create targets
for (var i = 0; i < 5; i++) {
var target = new Target();
- target.x = Math.random() * 2048;
- target.y = Math.random() * 2732;
+ target.x = 2048 / 2;
+ target.y = 2732 / 2;
targets.push(target);
game.addChild(target);
}
// Handle shooting
merminin ucu y eksenin pozitif kısmına baksın böyle bir mermi tasarımı istiyorum. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
tekli balon resmi. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
havai fişek patlaması. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
background ıcın guzel ve yaratıcı resımler. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
taş resmi. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.