/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
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.5;
self.targetX = 1024;
self.targetY = 1366;
self.isDestroyed = false;
self.update = function () {
if (self.isDestroyed) return;
// Move toward center
var dx = self.targetX - self.x;
var dy = self.targetY - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 5) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
}
};
self.down = function (x, y, obj) {
if (self.isDestroyed) return;
self.isDestroyed = true;
LK.setScore(LK.getScore() + 10);
scoreTxt.setText(LK.getScore());
// Create explosion effect
var explosion = game.addChild(LK.getAsset('explosion', {
anchorX: 0.5,
anchorY: 0.5,
x: self.x,
y: self.y,
scaleX: 0.1,
scaleY: 0.1
}));
// Animate explosion
tween(explosion, {
scaleX: 2,
scaleY: 2,
alpha: 0
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
explosion.destroy();
}
});
LK.getSound('zombieHit').play();
// Mark for removal
for (var i = 0; i < zombies.length; i++) {
if (zombies[i] === self) {
zombies[i].shouldRemove = true;
break;
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2F4F4F
});
/****
* Game Code
****/
// Game variables
var zombies = [];
var player;
var scoreTxt;
var waveLevel = 1;
var zombieSpawnRate = 120; // Spawn every 2 seconds initially
var zombieSpeed = 1.5;
var lastZombieSpawn = 0;
// Create player at center
player = game.addChild(new Player());
player.x = 1024;
player.y = 1366;
// Create score display
scoreTxt = new Text2('0', {
size: 100,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
scoreTxt.y = 100;
// Wave level display
var waveTxt = new Text2('Wave 1', {
size: 60,
fill: 0xFFFF00
});
waveTxt.anchor.set(0, 0);
LK.gui.topRight.addChild(waveTxt);
waveTxt.x = -200;
waveTxt.y = 50;
function spawnZombie() {
var zombie = new Zombie();
// Random spawn from edges
var edge = Math.floor(Math.random() * 4);
switch (edge) {
case 0:
// Top
zombie.x = Math.random() * 2048;
zombie.y = -40;
break;
case 1:
// Right
zombie.x = 2088;
zombie.y = Math.random() * 2732;
break;
case 2:
// Bottom
zombie.x = Math.random() * 2048;
zombie.y = 2772;
break;
case 3:
// Left
zombie.x = -40;
zombie.y = Math.random() * 2732;
break;
}
zombie.speed = zombieSpeed;
zombies.push(zombie);
game.addChild(zombie);
LK.getSound('zombieSpawn').play();
}
function checkGameOver() {
for (var i = 0; i < zombies.length; i++) {
var zombie = zombies[i];
if (zombie.isDestroyed) continue;
var dx = zombie.x - player.x;
var dy = zombie.y - player.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 50) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
return;
}
}
}
function updateWave() {
var currentScore = LK.getScore();
var newWaveLevel = Math.floor(currentScore / 100) + 1;
if (newWaveLevel > waveLevel) {
waveLevel = newWaveLevel;
waveTxt.setText('Wave ' + waveLevel);
// Increase difficulty
zombieSpawnRate = Math.max(30, zombieSpawnRate - 10);
zombieSpeed += 0.3;
LK.effects.flashScreen(0x00ff00, 500);
}
}
game.update = function () {
// Spawn zombies
if (LK.ticks - lastZombieSpawn > zombieSpawnRate) {
spawnZombie();
lastZombieSpawn = LK.ticks;
}
// Clean up destroyed zombies
for (var i = zombies.length - 1; i >= 0; i--) {
var zombie = zombies[i];
if (zombie.shouldRemove) {
zombie.destroy();
zombies.splice(i, 1);
}
}
// Check for game over
checkGameOver();
// Update wave progression
updateWave();
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,190 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var Player = Container.expand(function () {
+ var self = Container.call(this);
+ var playerGraphics = self.attachAsset('player', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ 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.5;
+ self.targetX = 1024;
+ self.targetY = 1366;
+ self.isDestroyed = false;
+ self.update = function () {
+ if (self.isDestroyed) return;
+ // Move toward center
+ var dx = self.targetX - self.x;
+ var dy = self.targetY - self.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance > 5) {
+ self.x += dx / distance * self.speed;
+ self.y += dy / distance * self.speed;
+ }
+ };
+ self.down = function (x, y, obj) {
+ if (self.isDestroyed) return;
+ self.isDestroyed = true;
+ LK.setScore(LK.getScore() + 10);
+ scoreTxt.setText(LK.getScore());
+ // Create explosion effect
+ var explosion = game.addChild(LK.getAsset('explosion', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: self.x,
+ y: self.y,
+ scaleX: 0.1,
+ scaleY: 0.1
+ }));
+ // Animate explosion
+ tween(explosion, {
+ scaleX: 2,
+ scaleY: 2,
+ alpha: 0
+ }, {
+ duration: 300,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ explosion.destroy();
+ }
+ });
+ LK.getSound('zombieHit').play();
+ // Mark for removal
+ for (var i = 0; i < zombies.length; i++) {
+ if (zombies[i] === self) {
+ zombies[i].shouldRemove = true;
+ break;
+ }
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x2F4F4F
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var zombies = [];
+var player;
+var scoreTxt;
+var waveLevel = 1;
+var zombieSpawnRate = 120; // Spawn every 2 seconds initially
+var zombieSpeed = 1.5;
+var lastZombieSpawn = 0;
+// Create player at center
+player = game.addChild(new Player());
+player.x = 1024;
+player.y = 1366;
+// Create score display
+scoreTxt = new Text2('0', {
+ size: 100,
+ fill: 0xFFFFFF
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+scoreTxt.y = 100;
+// Wave level display
+var waveTxt = new Text2('Wave 1', {
+ size: 60,
+ fill: 0xFFFF00
+});
+waveTxt.anchor.set(0, 0);
+LK.gui.topRight.addChild(waveTxt);
+waveTxt.x = -200;
+waveTxt.y = 50;
+function spawnZombie() {
+ var zombie = new Zombie();
+ // Random spawn from edges
+ var edge = Math.floor(Math.random() * 4);
+ switch (edge) {
+ case 0:
+ // Top
+ zombie.x = Math.random() * 2048;
+ zombie.y = -40;
+ break;
+ case 1:
+ // Right
+ zombie.x = 2088;
+ zombie.y = Math.random() * 2732;
+ break;
+ case 2:
+ // Bottom
+ zombie.x = Math.random() * 2048;
+ zombie.y = 2772;
+ break;
+ case 3:
+ // Left
+ zombie.x = -40;
+ zombie.y = Math.random() * 2732;
+ break;
+ }
+ zombie.speed = zombieSpeed;
+ zombies.push(zombie);
+ game.addChild(zombie);
+ LK.getSound('zombieSpawn').play();
+}
+function checkGameOver() {
+ for (var i = 0; i < zombies.length; i++) {
+ var zombie = zombies[i];
+ if (zombie.isDestroyed) continue;
+ var dx = zombie.x - player.x;
+ var dy = zombie.y - player.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance < 50) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ return;
+ }
+ }
+}
+function updateWave() {
+ var currentScore = LK.getScore();
+ var newWaveLevel = Math.floor(currentScore / 100) + 1;
+ if (newWaveLevel > waveLevel) {
+ waveLevel = newWaveLevel;
+ waveTxt.setText('Wave ' + waveLevel);
+ // Increase difficulty
+ zombieSpawnRate = Math.max(30, zombieSpawnRate - 10);
+ zombieSpeed += 0.3;
+ LK.effects.flashScreen(0x00ff00, 500);
+ }
+}
+game.update = function () {
+ // Spawn zombies
+ if (LK.ticks - lastZombieSpawn > zombieSpawnRate) {
+ spawnZombie();
+ lastZombieSpawn = LK.ticks;
+ }
+ // Clean up destroyed zombies
+ for (var i = zombies.length - 1; i >= 0; i--) {
+ var zombie = zombies[i];
+ if (zombie.shouldRemove) {
+ zombie.destroy();
+ zombies.splice(i, 1);
+ }
+ }
+ // Check for game over
+ checkGameOver();
+ // Update wave progression
+ updateWave();
+};
\ No newline at end of file
9mm mermi . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
glock29 . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
zombi . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
zombi . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
zombi. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Bir adet bandanası olsun ve yüzünde savaş çizikleri olsun