User prompt
az zombi gelsin
User prompt
zombi sayısı puan artıkça artmasın
User prompt
düşman dikey olarak gelsin, sekmesin, yön değiştirmesin
User prompt
powerup gelmesin
User prompt
oyuncunun yanlarındaki powerupları kaldır
User prompt
her 20 zombide bir 3 saniye zombi gelmeyince bir sonraki 20 zombilik periodu 5 artır
User prompt
puan 1000e ulaşınca powerupın yerine karakter koy
User prompt
duran poweruplara ateş edince yeni character oluşsun
User prompt
tıklanınca değil de ateş edince olsun
User prompt
powerupa tıklanınca yeni character oluşsun
User prompt
yukarıdan powerup düşmesin
User prompt
yukarıdan powerup düşmesin
User prompt
her 300 score olunca bu olayı gerçekleştir
User prompt
her 20 zombide bir 3 saniye zombi gelmesin
User prompt
yukarıdan powerup yağıyor düzelt
User prompt
her düşman saldırısı wave olsun her wavede 2 zombi sayısı artsın. (wave 1: 5 zombi)
User prompt
biraz uzağa
User prompt
biraz uzağa
User prompt
az daha yana
User prompt
oyuncunun az sağına ve soluna artı butonları ekle
User prompt
zombiler wave 1 ile wave 10 arasında olsun
User prompt
Compilation error[L18]: Plugins failed to load.
User prompt
zombileri daha çok ama yavaş yap
User prompt
en sona nesne ekle düşman ona ulaşırsa can gitsin
User prompt
karakter ilerlemesin
/**** * Classes ****/ // Bullet class var Bullet = Container.expand(function () { var self = Container.call(this); var bulletSprite = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5, flipY: 1 // flip vertically }); // Target coordinates for the bullet self.targetX = null; self.targetY = null; self.speed = 48; // pixels per frame, positive value self.dirX = 0; self.dirY = -1; self.setTarget = function (tx, ty) { // Calculate direction vector var dx = tx - self.x; var dy = ty - self.y; var len = Math.sqrt(dx * dx + dy * dy); if (len > 0) { self.dirX = dx / len; self.dirY = dy / len; } else { self.dirX = 0; self.dirY = -1; } self.targetX = tx; self.targetY = ty; }; self.update = function () { // Store lastX/lastY for event triggers if (typeof self.lastX === "undefined") self.lastX = self.x; if (typeof self.lastY === "undefined") self.lastY = self.y; // Move in direction self.x += self.dirX * self.speed; self.y += self.dirY * self.speed; // Rotate bullet sprite to face movement direction if (self.dirX !== 0 || self.dirY !== 0) { // atan2 returns angle in radians, 0 is to the right, so subtract Math.PI/2 to make 0 point up bulletSprite.rotation = Math.atan2(self.dirY, self.dirX) - Math.PI / 2; } // Update lastX/lastY for next frame self.lastX = self.x; self.lastY = self.y; }; return self; }); // Enemy class var Enemy = Container.expand(function () { var self = Container.call(this); var enemySprite = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.radius = enemySprite.width * 0.5; self.speed = 3 + Math.random() * 3; // much slower zombies self.dir = Math.random() < 0.5 ? -1 : 1; self.xSpeed = self.dir * (2 + Math.random() * 3); // also slow horizontal self.update = function () { self.y += self.speed; self.x += self.xSpeed; // Bounce off walls if (self.x < self.radius) { self.x = self.radius; self.xSpeed *= -1; } if (self.x > 2048 - self.radius) { self.x = 2048 - self.radius; self.xSpeed *= -1; } }; return self; }); // Obstacle class var Obstacle = Container.expand(function () { var self = Container.call(this); var obsSprite = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); self.width = obsSprite.width; self.height = obsSprite.height; self.speed = 12 + Math.random() * 8; self.update = function () { self.y += self.speed; }; return self; }); // Player class var Player = Container.expand(function () { var self = Container.call(this); var playerSprite = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.radius = playerSprite.width * 0.5; self.lives = 3; self.invincible = false; self.invincibleTicks = 0; self.shootCooldown = 0; self.update = function () { if (self.invincible) { self.invincibleTicks--; if (self.invincibleTicks <= 0) { self.invincible = false; playerSprite.alpha = 1; } else { // Flicker effect playerSprite.alpha = LK.ticks % 10 < 5 ? 0.4 : 1; } } if (self.shootCooldown > 0) self.shootCooldown--; }; // Called when player is hit self.hit = function () { if (self.invincible) return; self.lives--; self.invincible = true; self.invincibleTicks = 90; // 1.5 seconds playerSprite.alpha = 0.4; LK.effects.flashObject(self, 0xff0000, 500); LK.getSound('hit').play(); }; // Called when player picks up a powerup self.powerup = function () { self.invincible = true; self.invincibleTicks = 180; // 3 seconds playerSprite.alpha = 0.4; LK.getSound('powerup').play(); }; return self; }); // Powerup class var Powerup = Container.expand(function () { var self = Container.call(this); var puSprite = self.attachAsset('powerup', { anchorX: 0.5, anchorY: 0.5 }); self.radius = puSprite.width * 0.5; self.speed = 10; self.update = function () { self.y += self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x181818 }); /**** * Game Code ****/ // Game state variables // Player character: blue box // Enemy: red ellipse // Obstacle: orange box // Bullet: yellow box // Powerup: green ellipse // Sound effects // Music var player; var bullets = []; var enemies = []; // Removed obstacles array as obstacles are deleted from the game var powerups = []; var dragNode = null; var lastTouch = { x: 0, y: 0 }; var scoreTxt, livesTxt; var spawnTick = 0; var difficulty = 1; // wave number, always between 1 and 10 var gameOver = false; // Goal object at the bottom var goalObj = null; // UI scoreTxt = new Text2('0', { size: 120, fill: "#fff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); livesTxt = new Text2('♥♥♥', { size: 90, fill: 0xFF5252 }); livesTxt.anchor.set(1, 0); LK.gui.topRight.addChild(livesTxt); // Start music LK.playMusic('arcadebg'); // Create player player = new Player(); player.x = 2048 / 2; player.y = 2732 - 350; game.addChild(player); // Add plus buttons to the right and left of the player var plusBtnLeft = LK.getAsset('powerup', { anchorX: 0.5, anchorY: 0.5, x: player.x - 370, y: player.y, scaleX: 1.5, scaleY: 1.5 }); var plusBtnRight = LK.getAsset('powerup', { anchorX: 0.5, anchorY: 0.5, x: player.x + 370, y: player.y, scaleX: 1.5, scaleY: 1.5 }); game.addChild(plusBtnLeft); game.addChild(plusBtnRight); // Optionally, store for later use if you want to add interaction // Create goal object at the bottom center goalObj = LK.getAsset('obstacle', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 - 100, scaleX: 1.2, scaleY: 1.2 }); game.addChild(goalObj); // Helper: update lives display function updateLives() { var s = ''; for (var i = 0; i < player.lives; i++) s += '♥'; livesTxt.setText(s); } // Helper: spawn enemy function spawnEnemy() { var e = new Enemy(); e.x = 200 + Math.random() * (2048 - 400); e.y = -100; enemies.push(e); game.addChild(e); } // Removed spawnObstacle function as obstacles are deleted from the game // Helper: spawn powerup function spawnPowerup() { var p = new Powerup(); p.x = 200 + Math.random() * (2048 - 400); p.y = -80; powerups.push(p); game.addChild(p); } // Touch controls: drag player game.down = function (x, y, obj) { // Don't allow drag from top left 100x100 if (x < 100 && y < 100) return; if (player && !gameOver) { dragNode = player; lastTouch.x = x; lastTouch.y = y; } }; game.move = function (x, y, obj) { if (dragNode && !gameOver) { // Player movement disabled: do not update player.x or player.y lastTouch.x = x; lastTouch.y = y; } }; game.up = function (x, y, obj) { dragNode = null; }; // Tap to shoot (anywhere except top left 100x100) game.on('down', function (x, y, obj) { if (x < 100 && y < 100) return; if (player && !gameOver && player.shootCooldown <= 0) { var b = new Bullet(); b.x = player.x; b.y = player.y - player.radius - 20; b.setTarget(x, y); // Set bullet direction toward tap bullets.push(b); game.addChild(b); player.shootCooldown = 12; // 0.2s LK.getSound('shoot').play(); } }); // Main game loop game.update = function () { if (gameOver) return; // Increase difficulty over time, clamp between 1 and 10 if (LK.ticks % 600 === 0) { difficulty++; if (difficulty > 10) difficulty = 10; if (difficulty < 1) difficulty = 1; } // Player update player.update(); // Spawn logic spawnTick++; // Track total enemies spawned and pause after every 20 if (typeof totalEnemiesSpawned === "undefined") totalEnemiesSpawned = 0; if (typeof zombiePauseTicks === "undefined") zombiePauseTicks = 0; if (zombiePauseTicks > 0) { zombiePauseTicks--; } else { if (spawnTick % Math.max(30 - difficulty * 2, 8) === 0) { // spawn more zombies, higher chance var spawned = 0; if (Math.random() < 0.85) { spawnEnemy(); spawned++; } if (Math.random() < 0.25) { spawnEnemy(); spawned++; } // sometimes spawn two at once totalEnemiesSpawned += spawned; // After every 20th enemy, pause for 3 seconds (180 ticks), then increase the interval by 5 for the next period if (typeof zombiePauseInterval === "undefined") zombiePauseInterval = 20; if (totalEnemiesSpawned > 0 && totalEnemiesSpawned % zombiePauseInterval === 0) { zombiePauseTicks = 180; zombiePauseInterval += 5; } } } // Powerups no longer fall from the top // Bullets for (var i = bullets.length - 1; i >= 0; i--) { var b = bullets[i]; b.update(); if (b.y < -60) { b.destroy(); bullets.splice(i, 1); continue; } // Bullet hits enemy for (var j = enemies.length - 1; j >= 0; j--) { var e = enemies[j]; if (b.intersects(e)) { LK.setScore(LK.getScore() + 10); scoreTxt.setText(LK.getScore()); LK.getSound('enemyDown').play(); e.destroy(); enemies.splice(j, 1); b.destroy(); bullets.splice(i, 1); break; } } } // Enemies for (var i = enemies.length - 1; i >= 0; i--) { var e = enemies[i]; e.update(); // Enemy reaches goal object if (goalObj && e.intersects(goalObj)) { if (!player.invincible) { player.hit(); updateLives(); if (player.lives <= 0) { gameOver = true; LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } } e.destroy(); enemies.splice(i, 1); continue; } if (e.y > 2732 + 100) { e.destroy(); enemies.splice(i, 1); continue; } // Enemy hits player if (e.intersects(player)) { if (!player.invincible) { player.hit(); updateLives(); if (player.lives <= 0) { gameOver = true; LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } } e.destroy(); enemies.splice(i, 1); } } // Obstacles removed from game // Powerups for (var i = powerups.length - 1; i >= 0; i--) { var p = powerups[i]; p.update(); if (p.y > 2732 + 80) { p.destroy(); powerups.splice(i, 1); continue; } // Powerup hits player if (p.intersects(player)) { player.powerup(); LK.setScore(LK.getScore() + 50); scoreTxt.setText(LK.getScore()); p.destroy(); powerups.splice(i, 1); } // Replace powerup with player character at score 1000 if (LK.getScore() >= 1000) { // Remove the powerup from the game p.destroy(); powerups.splice(i, 1); // Place a new player character at the powerup's position var newPlayer = new Player(); newPlayer.x = p.x; newPlayer.y = p.y; game.addChild(newPlayer); // Optionally, you can update the global player reference if you want to switch control // player = newPlayer; } } }; // Score display scoreTxt.setText(LK.getScore()); updateLives();
===================================================================
--- original.js
+++ change.js
@@ -319,11 +319,13 @@
spawnEnemy();
spawned++;
} // sometimes spawn two at once
totalEnemiesSpawned += spawned;
- // After every 20th enemy, pause for 3 seconds (180 ticks)
- if (totalEnemiesSpawned > 0 && totalEnemiesSpawned % 20 === 0) {
+ // After every 20th enemy, pause for 3 seconds (180 ticks), then increase the interval by 5 for the next period
+ if (typeof zombiePauseInterval === "undefined") zombiePauseInterval = 20;
+ if (totalEnemiesSpawned > 0 && totalEnemiesSpawned % zombiePauseInterval === 0) {
zombiePauseTicks = 180;
+ zombiePauseInterval += 5;
}
}
}
// Powerups no longer fall from the top
soldier pixel. In-Game asset. 2d. High contrast. No shadows
pixel ammo. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
pixel zombie character. In-Game asset. 2d. High contrast. No shadows
pixel brick wall. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Red zombie pixel. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
blood pixel. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
pixel shotgun. In-Game asset. 2d. High contrast. No shadows