User prompt
arka plan yap dağ olmasın kaynak olmasın bulut
User prompt
daha güzel zombilerin olduğu bir dünyanın arka planı
User prompt
daha değişik bir arka plan yap
User prompt
sadece haritanın altından zombi gelsin
User prompt
daha değişik bir arka plan yap
User prompt
arka plan ekle
User prompt
her zombiden 1 mermi düşsün ve oyuna 3 mermiyle başlayalım
User prompt
10 mermiyle başlasın oyun her zombiden 3 mermi gelsin
User prompt
zombiler 1 saniyede bir artsın ve hızlansınlar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
1.5 saniyede bir zombiler hızlansın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Best point yazsın
User prompt
Best Scor yazsın
User prompt
best skor yazsın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
en yüksek skorumuz yazsın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
mağza sistemini sil
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'toGlobal')' in or related to this line: 'var localPos = self.toLocal(obj.parent.toGlobal(obj.position));' Line Number: 168
User prompt
oyun bittikden sonra shop sistemi olsun ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
wave i sil
User prompt
her zombi öldürdüğümüzde 52 veya 56 arası coin alalım
User prompt
zombiler çeşitli olsun
User prompt
can barını kaldı
User prompt
sol alta zombilerin 3 kere vurunca ölceğimiz bir can barı ekle
User prompt
mermi zombilerin köşesine deyse bile zombi ölsün
User prompt
zombilere tıklayınca ölmesinler
User prompt
tabanca ekle
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.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 = 0; self.directionY = 0; self.isDestroyed = false; self.update = function () { if (self.isDestroyed) return; self.x += self.directionX * self.speed; self.y += self.directionY * self.speed; // Remove if off screen if (self.x < -50 || self.x > 2098 || self.y < -50 || self.y > 2782) { self.isDestroyed = true; self.shouldRemove = true; } }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); // Add weapon visual var weapon = self.attachAsset('gun', { anchorX: 0.5, anchorY: 1, scaleX: 1, scaleY: 1, y: -25 }); self.aimAtPoint = function (targetX, targetY) { var dx = targetX - self.x; var dy = targetY - self.y; var angle = Math.atan2(dy, dx) - Math.PI / 2; weapon.rotation = angle; }; return self; }); var ShopSystem = Container.expand(function () { var self = Container.call(this); // Shop background var shopBg = self.attachAsset('shopBackground', { width: 1800, height: 2200, color: 0x333333, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); // Title var titleText = new Text2('SHOP', { size: 120, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 0; titleText.y = -800; self.addChild(titleText); // Coins display var coinsText = new Text2('Coins: ' + (storage.coins || 0), { size: 80, fill: 0xFFD700 }); coinsText.anchor.set(0.5, 0.5); coinsText.x = 0; coinsText.y = -650; self.addChild(coinsText); // Shop items var items = [{ name: 'Faster Shooting', price: 500, type: 'shootSpeed' }, { name: 'More Damage', price: 800, type: 'damage' }, { name: 'Bigger Bullets', price: 300, type: 'bulletSize' }]; var itemButtons = []; for (var i = 0; i < items.length; i++) { var item = items[i]; var yPos = -300 + i * 200; // Item button background var buttonBg = self.addChild(LK.getAsset('itemButton', { width: 1400, height: 150, color: 0x555555, shape: 'box', anchorX: 0.5, anchorY: 0.5, x: 0, y: yPos })); // Item text var itemText = new Text2(item.name + ' - ' + item.price + ' coins', { size: 60, fill: 0xFFFFFF }); itemText.anchor.set(0.5, 0.5); itemText.x = 0; itemText.y = yPos; self.addChild(itemText); itemButtons.push({ button: buttonBg, item: item, text: itemText }); } // Close button var closeButton = self.addChild(LK.getAsset('closeButton', { width: 200, height: 100, color: 0xff4444, shape: 'box', anchorX: 0.5, anchorY: 0.5, x: 0, y: 800 })); var closeText = new Text2('CLOSE', { size: 50, fill: 0xFFFFFF }); closeText.anchor.set(0.5, 0.5); closeText.x = 0; closeText.y = 800; self.addChild(closeText); // Touch handlers self.down = function (x, y, obj) { var localPos = self.toLocal(obj.parent.toGlobal(obj.position)); // Check close button if (Math.abs(localPos.x) < 100 && Math.abs(localPos.y - 800) < 50) { self.visible = false; return; } // Check item buttons for (var i = 0; i < itemButtons.length; i++) { var btn = itemButtons[i]; var btnY = -300 + i * 200; if (Math.abs(localPos.x) < 700 && Math.abs(localPos.y - btnY) < 75) { var currentCoins = storage.coins || 0; if (currentCoins >= btn.item.price) { storage.coins = currentCoins - btn.item.price; // Apply upgrade if (btn.item.type === 'shootSpeed') { shootCooldown = Math.max(5, shootCooldown - 3); } else if (btn.item.type === 'damage') { bulletDamage = (bulletDamage || 1) + 1; } else if (btn.item.type === 'bulletSize') { bulletSize = (bulletSize || 1) + 0.2; } coinsText.setText('Coins: ' + storage.coins); } break; } } }; self.updateCoins = function () { coinsText.setText('Coins: ' + (storage.coins || 0)); }; return self; }); var Zombie = Container.expand(function () { var self = Container.call(this); // Choose random zombie type var zombieTypes = ['zombie1', 'zombie2', 'zombie3', 'zombie4']; var zombieType = zombieTypes[Math.floor(Math.random() * zombieTypes.length)]; var zombieGraphics = self.attachAsset(zombieType, { anchorX: 0.5, anchorY: 0.5 }); // Varying speeds based on zombie type var speedVariations = [1.5, 1.2, 1.8, 1.1]; var typeIndex = zombieTypes.indexOf(zombieType); self.speed = speedVariations[typeIndex] + (Math.random() * 0.4 - 0.2); // Add small random variation 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; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2F4F4F }); /**** * Game Code ****/ // Game variables var zombies = []; var bullets = []; var player; var scoreTxt; var zombieSpawnRate = 120; // Spawn every 2 seconds initially var zombieSpeed = 1.5; var lastZombieSpawn = 0; var lastShot = 0; var shootCooldown = 15; // 15 frames between shots (4 shots per second) // Shop system variables var shopSystem; var bulletDamage = 1; var bulletSize = 1; // Initialize coins from storage if (!storage.coins) { storage.coins = 0; } // Create player at center player = game.addChild(new Player()); player.x = 1024; player.y = 1366; // Create shop system shopSystem = game.addChild(new ShopSystem()); shopSystem.x = 1024; shopSystem.y = 1366; shopSystem.visible = false; // 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; // Shooting function function shootBullet(targetX, targetY) { if (LK.ticks - lastShot < shootCooldown) return; var bullet = new Bullet(); bullet.x = player.x; bullet.y = player.y; // Calculate direction var dx = targetX - player.x; var dy = targetY - player.y; var distance = Math.sqrt(dx * dx + dy * dy); bullet.directionX = dx / distance; bullet.directionY = dy / distance; bullets.push(bullet); game.addChild(bullet); LK.getSound('gunShot').play(); lastShot = LK.ticks; } // Touch/click controls game.down = function (x, y, obj) { player.aimAtPoint(x, y); shootBullet(x, y); }; 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 checkBulletCollisions() { for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; if (bullet.isDestroyed) continue; for (var j = 0; j < zombies.length; j++) { var zombie = zombies[j]; if (zombie.isDestroyed) continue; var dx = bullet.x - zombie.x; var dy = bullet.y - zombie.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 75) { // Hit zombie bullet.isDestroyed = true; bullet.shouldRemove = true; zombie.isDestroyed = true; LK.getSound('zombieHit').play(); // Add random coin reward between 52-56 var coinReward = Math.floor(Math.random() * 5) + 52; // Random between 52-56 LK.setScore(LK.getScore() + coinReward); scoreTxt.setText(LK.getScore()); // Add coins to storage storage.coins = (storage.coins || 0) + coinReward; // Create explosion effect var explosion = game.addChild(LK.getAsset('explosion', { anchorX: 0.5, anchorY: 0.5, x: zombie.x, y: zombie.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(); } }); // Mark zombie for removal for (var k = 0; k < zombies.length; k++) { if (zombies[k] === zombie) { zombies[k].shouldRemove = true; break; } } break; } } } } 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); // Show shop instead of game over shopSystem.visible = true; shopSystem.updateCoins(); // Pause game for (var z = 0; z < zombies.length; z++) { zombies[z].speed = 0; } return; } } } game.update = function () { // Spawn zombies if (LK.ticks - lastZombieSpawn > zombieSpawnRate) { spawnZombie(); lastZombieSpawn = LK.ticks; } // Clean up destroyed bullets for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; if (bullet.shouldRemove) { bullet.destroy(); bullets.splice(i, 1); } } // 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 bullet collisions checkBulletCollisions(); // Check for game over checkGameOver(); };
===================================================================
--- original.js
+++ change.js
@@ -1,8 +1,9 @@
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
@@ -49,8 +50,135 @@
weapon.rotation = angle;
};
return self;
});
+var ShopSystem = Container.expand(function () {
+ var self = Container.call(this);
+ // Shop background
+ var shopBg = self.attachAsset('shopBackground', {
+ width: 1800,
+ height: 2200,
+ color: 0x333333,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Title
+ var titleText = new Text2('SHOP', {
+ size: 120,
+ fill: 0xFFFFFF
+ });
+ titleText.anchor.set(0.5, 0.5);
+ titleText.x = 0;
+ titleText.y = -800;
+ self.addChild(titleText);
+ // Coins display
+ var coinsText = new Text2('Coins: ' + (storage.coins || 0), {
+ size: 80,
+ fill: 0xFFD700
+ });
+ coinsText.anchor.set(0.5, 0.5);
+ coinsText.x = 0;
+ coinsText.y = -650;
+ self.addChild(coinsText);
+ // Shop items
+ var items = [{
+ name: 'Faster Shooting',
+ price: 500,
+ type: 'shootSpeed'
+ }, {
+ name: 'More Damage',
+ price: 800,
+ type: 'damage'
+ }, {
+ name: 'Bigger Bullets',
+ price: 300,
+ type: 'bulletSize'
+ }];
+ var itemButtons = [];
+ for (var i = 0; i < items.length; i++) {
+ var item = items[i];
+ var yPos = -300 + i * 200;
+ // Item button background
+ var buttonBg = self.addChild(LK.getAsset('itemButton', {
+ width: 1400,
+ height: 150,
+ color: 0x555555,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: yPos
+ }));
+ // Item text
+ var itemText = new Text2(item.name + ' - ' + item.price + ' coins', {
+ size: 60,
+ fill: 0xFFFFFF
+ });
+ itemText.anchor.set(0.5, 0.5);
+ itemText.x = 0;
+ itemText.y = yPos;
+ self.addChild(itemText);
+ itemButtons.push({
+ button: buttonBg,
+ item: item,
+ text: itemText
+ });
+ }
+ // Close button
+ var closeButton = self.addChild(LK.getAsset('closeButton', {
+ width: 200,
+ height: 100,
+ color: 0xff4444,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: 800
+ }));
+ var closeText = new Text2('CLOSE', {
+ size: 50,
+ fill: 0xFFFFFF
+ });
+ closeText.anchor.set(0.5, 0.5);
+ closeText.x = 0;
+ closeText.y = 800;
+ self.addChild(closeText);
+ // Touch handlers
+ self.down = function (x, y, obj) {
+ var localPos = self.toLocal(obj.parent.toGlobal(obj.position));
+ // Check close button
+ if (Math.abs(localPos.x) < 100 && Math.abs(localPos.y - 800) < 50) {
+ self.visible = false;
+ return;
+ }
+ // Check item buttons
+ for (var i = 0; i < itemButtons.length; i++) {
+ var btn = itemButtons[i];
+ var btnY = -300 + i * 200;
+ if (Math.abs(localPos.x) < 700 && Math.abs(localPos.y - btnY) < 75) {
+ var currentCoins = storage.coins || 0;
+ if (currentCoins >= btn.item.price) {
+ storage.coins = currentCoins - btn.item.price;
+ // Apply upgrade
+ if (btn.item.type === 'shootSpeed') {
+ shootCooldown = Math.max(5, shootCooldown - 3);
+ } else if (btn.item.type === 'damage') {
+ bulletDamage = (bulletDamage || 1) + 1;
+ } else if (btn.item.type === 'bulletSize') {
+ bulletSize = (bulletSize || 1) + 0.2;
+ }
+ coinsText.setText('Coins: ' + storage.coins);
+ }
+ break;
+ }
+ }
+ };
+ self.updateCoins = function () {
+ coinsText.setText('Coins: ' + (storage.coins || 0));
+ };
+ return self;
+});
var Zombie = Container.expand(function () {
var self = Container.call(this);
// Choose random zombie type
var zombieTypes = ['zombie1', 'zombie2', 'zombie3', 'zombie4'];
@@ -99,12 +227,25 @@
var zombieSpeed = 1.5;
var lastZombieSpawn = 0;
var lastShot = 0;
var shootCooldown = 15; // 15 frames between shots (4 shots per second)
+// Shop system variables
+var shopSystem;
+var bulletDamage = 1;
+var bulletSize = 1;
+// Initialize coins from storage
+if (!storage.coins) {
+ storage.coins = 0;
+}
// Create player at center
player = game.addChild(new Player());
player.x = 1024;
player.y = 1366;
+// Create shop system
+shopSystem = game.addChild(new ShopSystem());
+shopSystem.x = 1024;
+shopSystem.y = 1366;
+shopSystem.visible = false;
// Create score display
scoreTxt = new Text2('0', {
size: 100,
fill: 0xFFFFFF
@@ -184,8 +325,10 @@
// Add random coin reward between 52-56
var coinReward = Math.floor(Math.random() * 5) + 52; // Random between 52-56
LK.setScore(LK.getScore() + coinReward);
scoreTxt.setText(LK.getScore());
+ // Add coins to storage
+ storage.coins = (storage.coins || 0) + coinReward;
// Create explosion effect
var explosion = game.addChild(LK.getAsset('explosion', {
anchorX: 0.5,
anchorY: 0.5,
@@ -226,9 +369,15 @@
var dy = zombie.y - player.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 50) {
LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver();
+ // Show shop instead of game over
+ shopSystem.visible = true;
+ shopSystem.updateCoins();
+ // Pause game
+ for (var z = 0; z < zombies.length; z++) {
+ zombies[z].speed = 0;
+ }
return;
}
}
}
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