/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.directionX = 1; self.directionY = 0; self.lifespan = 120; self.update = function () { self.x += self.directionX * self.speed; self.y += self.directionY * self.speed; self.lifespan--; if (self.lifespan <= 0) { self.shouldDestroy = true; } if (self.x < -50 || self.x > 2098 || self.y < -50 || self.y > 2782) { self.shouldDestroy = true; } }; return self; }); var HealthPack = Container.expand(function () { var self = Container.call(this); var healthGraphics = self.attachAsset('healthPack', { anchorX: 0.5, anchorY: 0.5 }); self.healAmount = 30; self.collected = false; self.update = function () { if (!self.collected && self.intersects(player)) { player.heal(self.healAmount); LK.getSound('pickup').play(); self.collected = true; self.shouldDestroy = true; } }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.health = 100; self.maxHealth = 100; self.shootCooldown = 0; self.lastMoveX = 1; self.lastMoveY = 0; self.takeDamage = function (damage) { self.health -= damage; if (self.health <= 0) { self.health = 0; } LK.effects.flashObject(self, 0xFF0000, 300); }; self.heal = function (amount) { self.health = Math.min(self.maxHealth, self.health + amount); }; self.update = function () { if (self.shootCooldown > 0) { self.shootCooldown--; } }; return self; }); var Zombie = Container.expand(function () { var self = Container.call(this); var zombieGraphics = self.attachAsset('zombie', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1; self.health = 1; self.damage = 10; self.lastPlayerCollision = false; self.update = function () { var dx = player.x - self.x; var dy = player.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } var currentCollision = self.intersects(player); if (!self.lastPlayerCollision && currentCollision) { player.takeDamage(self.damage); } self.lastPlayerCollision = currentCollision; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2C5530 }); /**** * Game Code ****/ var player; var zombies = []; var bullets = []; var healthPacks = []; var waveNumber = 1; var zombieSpawnRate = 120; var healthPackSpawnRate = 1800; var lastHealthPackSpawn = 0; var dragActive = false; // UI Elements var scoreText = new Text2('Score: 0', { size: 60, fill: 0xFFFFFF }); scoreText.anchor.set(0, 0); scoreText.x = 120; scoreText.y = 50; LK.gui.topLeft.addChild(scoreText); var healthText = new Text2('Health: 100', { size: 60, fill: 0xFF0000 }); healthText.anchor.set(1, 0); LK.gui.topRight.addChild(healthText); var waveText = new Text2('Wave: 1', { size: 50, fill: 0xFFFF00 }); waveText.anchor.set(0.5, 0); LK.gui.top.addChild(waveText); // Initialize player player = game.addChild(new Player()); player.x = 1024; player.y = 1366; function spawnZombie() { var zombie = new Zombie(); var side = Math.floor(Math.random() * 4); switch (side) { case 0: // Top zombie.x = Math.random() * 2048; zombie.y = -30; break; case 1: // Right zombie.x = 2078; zombie.y = Math.random() * 2732; break; case 2: // Bottom zombie.x = Math.random() * 2048; zombie.y = 2762; break; case 3: // Left zombie.x = -30; zombie.y = Math.random() * 2732; break; } zombie.speed = 0.8 + waveNumber * 0.1; zombies.push(zombie); game.addChild(zombie); } function spawnHealthPack() { var healthPack = new HealthPack(); healthPack.x = 200 + Math.random() * 1648; healthPack.y = 200 + Math.random() * 2332; healthPacks.push(healthPack); game.addChild(healthPack); } function shootBullet() { if (player.shootCooldown <= 0) { var bullet = new Bullet(); bullet.x = player.x; bullet.y = player.y; bullet.directionX = player.lastMoveX; bullet.directionY = player.lastMoveY; bullets.push(bullet); game.addChild(bullet); player.shootCooldown = 15; LK.getSound('shoot').play(); } } game.down = function (x, y, obj) { dragActive = true; player.x = x; player.y = y; var dx = x - player.x; var dy = y - player.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { player.lastMoveX = dx / distance; player.lastMoveY = dy / distance; } shootBullet(); }; game.move = function (x, y, obj) { if (dragActive) { var dx = x - player.x; var dy = y - player.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 5) { player.x = x; player.y = y; if (distance > 0) { player.lastMoveX = dx / distance; player.lastMoveY = dy / distance; } } } }; game.up = function (x, y, obj) { dragActive = false; }; game.update = function () { // Check for game over if (player.health <= 0) { LK.showGameOver(); return; } // Update UI scoreText.setText('Score: ' + LK.getScore()); healthText.setText('Health: ' + player.health); waveText.setText('Wave: ' + waveNumber); // Spawn zombies if (LK.ticks % zombieSpawnRate === 0) { spawnZombie(); } // Increase difficulty over time if (LK.ticks % 1800 === 0) { waveNumber++; if (zombieSpawnRate > 30) { zombieSpawnRate -= 5; } } // Spawn health packs if (LK.ticks - lastHealthPackSpawn > healthPackSpawnRate && Math.random() < 0.1) { spawnHealthPack(); lastHealthPackSpawn = LK.ticks; } // Auto shoot if (LK.ticks % 20 === 0) { shootBullet(); } // Keep player in bounds player.x = Math.max(40, Math.min(2008, player.x)); player.y = Math.max(40, Math.min(2692, player.y)); // Update bullets for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; if (bullet.shouldDestroy) { bullet.destroy(); bullets.splice(i, 1); continue; } // Check bullet-zombie collisions for (var j = zombies.length - 1; j >= 0; j--) { var zombie = zombies[j]; if (bullet.intersects(zombie)) { zombie.health--; if (zombie.health <= 0) { LK.setScore(LK.getScore() + 10); LK.getSound('zombieHit').play(); zombie.destroy(); zombies.splice(j, 1); } bullet.shouldDestroy = true; break; } } } // Update health packs for (var i = healthPacks.length - 1; i >= 0; i--) { var healthPack = healthPacks[i]; if (healthPack.shouldDestroy) { healthPack.destroy(); healthPacks.splice(i, 1); } } };
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,294 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var Bullet = Container.expand(function () {
+ var self = Container.call(this);
+ var bulletGraphics = self.attachAsset('bullet', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 8;
+ self.directionX = 1;
+ self.directionY = 0;
+ self.lifespan = 120;
+ self.update = function () {
+ self.x += self.directionX * self.speed;
+ self.y += self.directionY * self.speed;
+ self.lifespan--;
+ if (self.lifespan <= 0) {
+ self.shouldDestroy = true;
+ }
+ if (self.x < -50 || self.x > 2098 || self.y < -50 || self.y > 2782) {
+ self.shouldDestroy = true;
+ }
+ };
+ return self;
+});
+var HealthPack = Container.expand(function () {
+ var self = Container.call(this);
+ var healthGraphics = self.attachAsset('healthPack', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.healAmount = 30;
+ self.collected = false;
+ self.update = function () {
+ if (!self.collected && self.intersects(player)) {
+ player.heal(self.healAmount);
+ LK.getSound('pickup').play();
+ self.collected = true;
+ self.shouldDestroy = true;
+ }
+ };
+ return self;
+});
+var Player = Container.expand(function () {
+ var self = Container.call(this);
+ var playerGraphics = self.attachAsset('player', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.health = 100;
+ self.maxHealth = 100;
+ self.shootCooldown = 0;
+ self.lastMoveX = 1;
+ self.lastMoveY = 0;
+ self.takeDamage = function (damage) {
+ self.health -= damage;
+ if (self.health <= 0) {
+ self.health = 0;
+ }
+ LK.effects.flashObject(self, 0xFF0000, 300);
+ };
+ self.heal = function (amount) {
+ self.health = Math.min(self.maxHealth, self.health + amount);
+ };
+ self.update = function () {
+ if (self.shootCooldown > 0) {
+ self.shootCooldown--;
+ }
+ };
+ return self;
+});
+var Zombie = Container.expand(function () {
+ var self = Container.call(this);
+ var zombieGraphics = self.attachAsset('zombie', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 1;
+ self.health = 1;
+ self.damage = 10;
+ self.lastPlayerCollision = false;
+ self.update = function () {
+ var dx = player.x - self.x;
+ var dy = player.y - self.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance > 0) {
+ self.x += dx / distance * self.speed;
+ self.y += dy / distance * self.speed;
+ }
+ var currentCollision = self.intersects(player);
+ if (!self.lastPlayerCollision && currentCollision) {
+ player.takeDamage(self.damage);
+ }
+ self.lastPlayerCollision = currentCollision;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x2C5530
+});
+
+/****
+* Game Code
+****/
+var player;
+var zombies = [];
+var bullets = [];
+var healthPacks = [];
+var waveNumber = 1;
+var zombieSpawnRate = 120;
+var healthPackSpawnRate = 1800;
+var lastHealthPackSpawn = 0;
+var dragActive = false;
+// UI Elements
+var scoreText = new Text2('Score: 0', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+scoreText.anchor.set(0, 0);
+scoreText.x = 120;
+scoreText.y = 50;
+LK.gui.topLeft.addChild(scoreText);
+var healthText = new Text2('Health: 100', {
+ size: 60,
+ fill: 0xFF0000
+});
+healthText.anchor.set(1, 0);
+LK.gui.topRight.addChild(healthText);
+var waveText = new Text2('Wave: 1', {
+ size: 50,
+ fill: 0xFFFF00
+});
+waveText.anchor.set(0.5, 0);
+LK.gui.top.addChild(waveText);
+// Initialize player
+player = game.addChild(new Player());
+player.x = 1024;
+player.y = 1366;
+function spawnZombie() {
+ var zombie = new Zombie();
+ var side = Math.floor(Math.random() * 4);
+ switch (side) {
+ case 0:
+ // Top
+ zombie.x = Math.random() * 2048;
+ zombie.y = -30;
+ break;
+ case 1:
+ // Right
+ zombie.x = 2078;
+ zombie.y = Math.random() * 2732;
+ break;
+ case 2:
+ // Bottom
+ zombie.x = Math.random() * 2048;
+ zombie.y = 2762;
+ break;
+ case 3:
+ // Left
+ zombie.x = -30;
+ zombie.y = Math.random() * 2732;
+ break;
+ }
+ zombie.speed = 0.8 + waveNumber * 0.1;
+ zombies.push(zombie);
+ game.addChild(zombie);
+}
+function spawnHealthPack() {
+ var healthPack = new HealthPack();
+ healthPack.x = 200 + Math.random() * 1648;
+ healthPack.y = 200 + Math.random() * 2332;
+ healthPacks.push(healthPack);
+ game.addChild(healthPack);
+}
+function shootBullet() {
+ if (player.shootCooldown <= 0) {
+ var bullet = new Bullet();
+ bullet.x = player.x;
+ bullet.y = player.y;
+ bullet.directionX = player.lastMoveX;
+ bullet.directionY = player.lastMoveY;
+ bullets.push(bullet);
+ game.addChild(bullet);
+ player.shootCooldown = 15;
+ LK.getSound('shoot').play();
+ }
+}
+game.down = function (x, y, obj) {
+ dragActive = true;
+ player.x = x;
+ player.y = y;
+ var dx = x - player.x;
+ var dy = y - player.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance > 0) {
+ player.lastMoveX = dx / distance;
+ player.lastMoveY = dy / distance;
+ }
+ shootBullet();
+};
+game.move = function (x, y, obj) {
+ if (dragActive) {
+ var dx = x - player.x;
+ var dy = y - player.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance > 5) {
+ player.x = x;
+ player.y = y;
+ if (distance > 0) {
+ player.lastMoveX = dx / distance;
+ player.lastMoveY = dy / distance;
+ }
+ }
+ }
+};
+game.up = function (x, y, obj) {
+ dragActive = false;
+};
+game.update = function () {
+ // Check for game over
+ if (player.health <= 0) {
+ LK.showGameOver();
+ return;
+ }
+ // Update UI
+ scoreText.setText('Score: ' + LK.getScore());
+ healthText.setText('Health: ' + player.health);
+ waveText.setText('Wave: ' + waveNumber);
+ // Spawn zombies
+ if (LK.ticks % zombieSpawnRate === 0) {
+ spawnZombie();
+ }
+ // Increase difficulty over time
+ if (LK.ticks % 1800 === 0) {
+ waveNumber++;
+ if (zombieSpawnRate > 30) {
+ zombieSpawnRate -= 5;
+ }
+ }
+ // Spawn health packs
+ if (LK.ticks - lastHealthPackSpawn > healthPackSpawnRate && Math.random() < 0.1) {
+ spawnHealthPack();
+ lastHealthPackSpawn = LK.ticks;
+ }
+ // Auto shoot
+ if (LK.ticks % 20 === 0) {
+ shootBullet();
+ }
+ // Keep player in bounds
+ player.x = Math.max(40, Math.min(2008, player.x));
+ player.y = Math.max(40, Math.min(2692, player.y));
+ // Update bullets
+ for (var i = bullets.length - 1; i >= 0; i--) {
+ var bullet = bullets[i];
+ if (bullet.shouldDestroy) {
+ bullet.destroy();
+ bullets.splice(i, 1);
+ continue;
+ }
+ // Check bullet-zombie collisions
+ for (var j = zombies.length - 1; j >= 0; j--) {
+ var zombie = zombies[j];
+ if (bullet.intersects(zombie)) {
+ zombie.health--;
+ if (zombie.health <= 0) {
+ LK.setScore(LK.getScore() + 10);
+ LK.getSound('zombieHit').play();
+ zombie.destroy();
+ zombies.splice(j, 1);
+ }
+ bullet.shouldDestroy = true;
+ break;
+ }
+ }
+ }
+ // Update health packs
+ for (var i = healthPacks.length - 1; i >= 0; i--) {
+ var healthPack = healthPacks[i];
+ if (healthPack.shouldDestroy) {
+ healthPack.destroy();
+ healthPacks.splice(i, 1);
+ }
+ }
+};
\ No newline at end of file
Fullscreen modern App Store landscape banner, 16:9, high definition, for a game titled "Zombie Survival Shooter" and with the description "Survive endless zombie waves in this action-packed shooter. Move, shoot, and stay alive as long as possible while zombies attack from all directions.". No text on banner!
un zombi de pixeles. In-Game asset. 2d. High contrast. No shadows
árbol echo de pixeles. In-Game asset. 2d. High contrast. No shadows
césped de pixeles. In-Game asset. 2d. High contrast. No shadows
bala de pistola de pixeles. In-Game asset. 2d. High contrast. No shadows
paquete de salud de pixeles. In-Game asset. 2d. High contrast. No shadows