User prompt
atılan mermiler düşmana çarptıktan sonra etrafınada zarar versin
User prompt
sağ üst köşede Hp ve oynama süresi alt alta olsun
User prompt
oyunu oynama süresi olsun
User prompt
mermi atışı yapabilmek için bekleme süresi oyun başladıktan 20 sonra 0,2 saniye olsun
User prompt
mermi atışı yapabilmek için bekleme süresi 0,3 saniye olsun
User prompt
mermi atışı yapabilmek için bekleme süresi 0,5 saniye olsun
User prompt
mermi atışı yapabilmek için bekleme süresi 1 saniye olsun
User prompt
bir adet mermi atılsın
User prompt
mermi atışı yapabilmek için bekleme süresi 1,5 saniye olsun
User prompt
mermi atış hızı biraz düşsün
User prompt
mermi 2 tane olsun
User prompt
seçilen müzik oyun müziği
User prompt
background assetsi oyun arka planı olsun tam ekran
User prompt
ateş edildikten sonra mermiler arası çok fazla olmasın
User prompt
mermi rastgele gitmesin 3 mermide yanyana orantılı gitsin
User prompt
Play yazısının arkasında hiçbir şey olmasın
User prompt
centercircler olmasın
User prompt
oyunu başlatmak için Play tusu olsun
User prompt
can yazısı Hp olsun
User prompt
hp bar ekranın sağ üst kösesinde görünsün
User prompt
hp bar sayı olsun
User prompt
hp bar olsun
User prompt
duvarın 10 canı olsun ve can sayısı ekranda görünsün
User prompt
düşman biraz düşsün
User prompt
her atışta rastgele 3 mermi gitsin
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Bomb class: Fired by the mortar, moves upward, explodes on contact with a note var Bomb = Container.expand(function () { var self = Container.call(this); var bombAsset = self.attachAsset('bomb', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 28; // Always positive, direction handled by dirX/dirY self.radius = bombAsset.width * 0.5; self.dirX = 0; self.dirY = -1; self.update = function () { if (typeof self.lastX === "undefined") self.lastX = self.x; if (typeof self.lastY === "undefined") self.lastY = self.y; self.x += self.dirX * self.speed; self.y += self.dirY * self.speed; self.lastX = self.x; self.lastY = self.y; }; return self; }); // Mortar class: Player's cannon, can be dragged horizontally and fires bombs var Mortar = Container.expand(function () { var self = Container.call(this); var mortarAsset = self.attachAsset('mortar', { anchorX: 0.5, anchorY: 1 }); self.width = mortarAsset.width; self.height = mortarAsset.height; // For a little animation on fire self.fireAnim = function () { tween(self, { scaleX: 1.2, scaleY: 0.85 }, { duration: 80, easing: tween.cubicOut, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 120, easing: tween.cubicIn }); } }); }; return self; }); // Note class: Descends from the top, must be destroyed before reaching the wall var Note = Container.expand(function () { var self = Container.call(this); var noteAsset = self.attachAsset('note', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 4 + Math.random() * 2; // Slower speed for notes (enemies) self.radius = noteAsset.width * 0.5; self.update = function () { self.y += self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x181c2c }); /**** * Game Code ****/ // --- Game constants --- var GAME_W = 2048; var GAME_H = 2732; var WALL_HEIGHT = 420; var MORTAR_Y = GAME_H - WALL_HEIGHT - 40; var NOTE_SPAWN_INTERVAL = 120; // frames (2 seconds at 60FPS) var NOTE_MIN_X = 180; var NOTE_MAX_X = GAME_W - 180; // --- Game state --- var bombs = []; var notes = []; var canShoot = true; var dragNode = null; var lastGameOver = false; var noteSpawnTick = 0; var notesPerSpawn = 1; var notesPerSpawnTick = 0; // --- Wall (defense line) --- var wallWidth = GAME_W; var wall = LK.getAsset('wall', { anchorX: 0, anchorY: 0, width: wallWidth, height: WALL_HEIGHT, x: 0, y: GAME_H - WALL_HEIGHT }); game.addChild(wall); // --- Mortar (player cannon) --- var mortar = new Mortar(); game.addChild(mortar); mortar.x = GAME_W / 2; mortar.y = MORTAR_Y; // --- Score display --- var scoreTxt = new Text2('0', { size: 120, fill: 0xFFF700 }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // --- Helper: Clamp mortar movement within screen --- function clampMortarX(x) { var halfW = mortar.width * 0.5; if (x < halfW + 40) return halfW + 40; if (x > GAME_W - halfW - 40) return GAME_W - halfW - 40; return x; } // --- Mortar is fixed: disable dragging --- game.down = function (x, y, obj) { // Do nothing, mortar is fixed }; game.up = function (x, y, obj) { // Do nothing, mortar is fixed }; game.move = function (x, y, obj) { // Do nothing, mortar is fixed }; // --- Tap to fire bomb --- game.tap = function (x, y, obj) { // Only allow firing if tap is above the mortar and not on the wall if (canShoot && y < mortar.y - 60) { lastTapTarget = { x: x, y: y }; fireBomb(); } }; // For mobile, treat 'down' as tap if not dragging game.down = function (origDown) { return function (x, y, obj) { origDown && origDown(x, y, obj); if (!dragNode && canShoot && y < mortar.y - 60) { lastTapTarget = { x: x, y: y }; fireBomb(); } }; }(game.down); // --- Fire bomb logic --- // Store the last tap target for bomb direction var lastTapTarget = { x: mortar.x, y: mortar.y - 800 }; function fireBomb() { // Fire 3 bombs at random angles centered around the tap direction var baseX = mortar.x; var baseY = mortar.y - mortar.height * 0.7; var dx = lastTapTarget.x - baseX; var dy = lastTapTarget.y - baseY; var len = Math.sqrt(dx * dx + dy * dy); if (len === 0) { dx = 0; dy = -1; len = 1; } var angle = Math.atan2(dy, dx); // Fire 3 bombs with random spread for (var i = 0; i < 3; i++) { var bomb = new Bomb(); bomb.x = baseX; bomb.y = baseY; // Spread: random angle offset between -0.25 and +0.25 radians (~±14 degrees) var spread = (Math.random() - 0.5) * 0.5; var bombAngle = angle + spread; bomb.dirX = Math.cos(bombAngle); bomb.dirY = Math.sin(bombAngle); bombs.push(bomb); game.addChild(bomb); } mortar.fireAnim(); // No cooldown, can always shoot } // --- Spawn a note at random X --- function spawnNote() { var note = new Note(); note.x = NOTE_MIN_X + Math.random() * (NOTE_MAX_X - NOTE_MIN_X); note.y = -note.height * 0.5; notes.push(note); game.addChild(note); } // --- Main update loop --- game.update = function () { // --- Bombs update --- for (var i = bombs.length - 1; i >= 0; i--) { var bomb = bombs[i]; bomb.update(); // Remove if off screen if (bomb.y < -bomb.height) { bomb.destroy(); bombs.splice(i, 1); continue; } // Check collision with notes for (var j = notes.length - 1; j >= 0; j--) { var note = notes[j]; var dx = bomb.x - note.x; var dy = bomb.y - note.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < bomb.radius + note.radius - 10) { // Hit! note.destroy(); notes.splice(j, 1); bomb.destroy(); bombs.splice(i, 1); // Score up LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); // Small explosion effect LK.effects.flashObject(mortar, 0xfff700, 200); break; } } } // --- Notes update --- for (var k = notes.length - 1; k >= 0; k--) { var note = notes[k]; note.update(); // If note hits the wall, just remove the note (wall health is unlimited) if (note.y + note.radius > wall.y) { note.destroy(); notes.splice(k, 1); continue; } // Remove if off screen (shouldn't happen) if (note.y > GAME_H + note.height) { note.destroy(); notes.splice(k, 1); } } // --- Spawn notes at interval --- noteSpawnTick++; notesPerSpawnTick++; if (noteSpawnTick >= NOTE_SPAWN_INTERVAL) { for (var n = 0; n < notesPerSpawn; n++) { spawnNote(); } noteSpawnTick = 0; } // Every 10 seconds (600 frames), increase notesPerSpawn by 1 if (notesPerSpawnTick >= 600) { notesPerSpawn++; notesPerSpawnTick = 0; } }; // --- Reset state on new game --- LK.on('gameStart', function () { // Remove all bombs and notes for (var i = 0; i < bombs.length; i++) bombs[i].destroy(); for (var j = 0; j < notes.length; j++) notes[j].destroy(); bombs = []; notes = []; canShoot = true; lastGameOver = false; noteSpawnTick = 0; notesPerSpawn = 1; notesPerSpawnTick = 0; LK.setScore(0); scoreTxt.setText('0'); mortar.x = GAME_W / 2; }); // --- Asset initialization (shapes) --- // Mortar: a simple ellipse/circle // Bomb: small dark circle // Note: yellow ellipse (music note) // Wall: wide rectangle /* End of gamecode.js */
===================================================================
--- original.js
+++ change.js
@@ -63,9 +63,9 @@
var noteAsset = self.attachAsset('note', {
anchorX: 0.5,
anchorY: 0.5
});
- self.speed = 8 + Math.random() * 4; // Slight speed variation
+ self.speed = 4 + Math.random() * 2; // Slower speed for notes (enemies)
self.radius = noteAsset.width * 0.5;
self.update = function () {
self.y += self.speed;
};
bu duvar geniş olsun
müzik notası olsun gözü ve keskin dişleri olsun. In-Game asset. 2d. High contrast. No shadows
gitar teli. In-Game asset. 2d. High contrast. No shadows
oyun background olacak.tam ekran olsun.bir konser sahnesine bakan koltuk bakış açısında olsun. In-Game asset. 2d. High contrast. No shadows
yüksek çözünürlüklü topdown bakış açısı makineli tüfek olsun. In-Game asset. 2d. High contrast. No shadows