User prompt
önceden eklediğimiz +10 score yazısını kaldır sadece cheats olsun ve arkaplanı dursun
User prompt
score yazısının altına CHEATS diye bir tıklanabilir menü ekle tıklandığında oyun dursun ve içerisindeki guide +10 score, god mode, game speed (2x, 3x) seçilebilir seçenekler ekle
User prompt
Paramız yetmese bile silaha tıkladığımızda buy ekranı açılsın. Eğer paramız yetmiyorsa "Para yetersiz" uyarısı çıksın ve sahip olmadığımız silahların üzeri kırmızı gözüksün. Silahların sağ tarafta durduğu yerin arkaplanına da gui yap
User prompt
Silahları aldığımızda puanımız düşsün pompalının fiyatı 20 skor olsun. smg puanı 100 olsun sniper da 100 olsun satın tıkladığımızda "BUY" yazılı bir seçme yeri gelsin. arkaplanı da olsun gui olur. düşmanların canı üzerlerinde bar olarak yazsın
User prompt
Sniper silahının menzili şuankinden 3 kat fazla olsun. Smg atış hızı çok fazla %80 yavaşlasın
User prompt
Pompalı ile sıktığımızda 3 mermi fırlatsın, smg ile sıktığımızda basılı tutunca tarasın, awp ile sıktığımızda adamı öldürsün mermi delsin arkaya geçsin
User prompt
oynadığımız alanın arkaplanını değiştirmek için de bir asset ekle ve sağ orta tarafa 3 farklı silah ekle : pompalı, smg, sniper bunların damage ve atış hızını kendine göre ayarla
User prompt
50. sıradaki boss 75. sıradaki boss ve 100. sıradaki bossun assetleri farklı olsun ve canları şöyle olsun: 50. sıradaki 20 , 75. sıradaki için 30 , 100. sıradaki için 50 can
User prompt
boss öldüğü esnada ölüm sesi de ekle ve +10 score yazan yerin arkasına hafif opaklığı kısık siyah arkaplan yap ki buton olduğu belli olsun. Ve arkaplan için de asset ayarı ekle
User prompt
Score yazısının tam altına tıklanabilir bir buton koy ve bu butona bastığımızda +10 skor eklensin ve sağ üst kısıma High Score yeri koy ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
her 25 skorda bir boss gelsin ve bu 10 vuruşta öldürülebilsin onun için de ayrı bir texture olsun ve bu boss geldiğinde müzik eklensin
User prompt
Her 10 skorda rakipler %10 daha hızlı olsun
User prompt
Mouse nereye bakarsa karakter de oraya baksın ve her yön için farklı asset de ekle
Code edit (1 edits merged)
Please save this source code
User prompt
Strike Zone - Top-Down Tactical Shooter
Initial prompt
Create a simple 2D top-down shooter game inspired by Counter-Strike, using Python and Pygame. 🔹 Features: The player is a rectangle or sprite that can move in 4 directions using WASD Aim and shoot using the mouse (left click fires bullets) Bullets move in the direction of the mouse and disappear on impact Enemies spawn randomly and move toward the player Basic health system: player dies if touched by enemy Score system: +1 point per enemy killed 🔹 Controls: Move: W = Up, A = Left, S = Down, D = Right Aim: Move the mouse cursor Shoot: Left Mouse Click 🔹 Extra (Optional): Add reload with R key, limited bullets per magazine Add a simple main menu and restart screen Please provide clean, well-commented code.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Boss = Container.expand(function () { var self = Container.call(this); var bossGraphics = self.attachAsset('boss', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 0.8; self.health = 10; self.maxHealth = 10; self.isBoss = true; self.lastPlayerX = 0; self.lastPlayerY = 0; self.update = function () { if (player) { 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; } self.lastPlayerX = player.x; self.lastPlayerY = player.y; } }; self.takeDamage = function () { self.health--; LK.effects.flashObject(self, 0xFF4444, 200); if (self.health <= 0) { LK.effects.flashObject(self, 0xFFFFFF, 500); return true; } return false; }; return self; }); 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.velocityX = 0; self.velocityY = 0; self.lifeTime = 120; self.age = 0; self.setDirection = function (targetX, targetY) { var dx = targetX - self.x; var dy = targetY - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.velocityX = dx / distance * self.speed; self.velocityY = dy / distance * self.speed; } }; self.update = function () { self.x += self.velocityX; self.y += self.velocityY; self.age++; }; self.isExpired = function () { return self.age >= self.lifeTime || self.x < -50 || self.x > 2098 || self.y < -50 || self.y > 2782; }; return self; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1.5; self.health = 1; self.lastPlayerX = 0; self.lastPlayerY = 0; self.update = function () { if (player) { 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; } self.lastPlayerX = player.x; self.lastPlayerY = player.y; } }; self.takeDamage = function () { self.health--; if (self.health <= 0) { LK.effects.flashObject(self, 0xFFFFFF, 200); return true; } return false; }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); // Create all directional graphics self.playerGraphicsUp = self.attachAsset('player_up', { anchorX: 0.5, anchorY: 0.5 }); self.playerGraphicsDown = self.attachAsset('player_down', { anchorX: 0.5, anchorY: 0.5, visible: false }); self.playerGraphicsLeft = self.attachAsset('player_left', { anchorX: 0.5, anchorY: 0.5, visible: false }); self.playerGraphicsRight = self.attachAsset('player_right', { anchorX: 0.5, anchorY: 0.5, visible: false }); self.currentDirection = 'up'; self.health = 100; self.maxHealth = 100; self.speed = 4; self.ammunition = 30; self.maxAmmo = 30; self.isReloading = false; self.reloadTime = 2000; self.setDirection = function (direction) { // Hide all graphics first self.playerGraphicsUp.visible = false; self.playerGraphicsDown.visible = false; self.playerGraphicsLeft.visible = false; self.playerGraphicsRight.visible = false; // Show the correct direction switch (direction) { case 'up': self.playerGraphicsUp.visible = true; break; case 'down': self.playerGraphicsDown.visible = true; break; case 'left': self.playerGraphicsLeft.visible = true; break; case 'right': self.playerGraphicsRight.visible = true; break; } self.currentDirection = direction; }; self.takeDamage = function (damage) { self.health -= damage; if (self.health <= 0) { self.health = 0; LK.effects.flashScreen(0xFF0000, 1000); LK.showGameOver(); } else { LK.effects.flashObject(self, 0xFF0000, 300); } }; self.reload = function () { if (!self.isReloading && self.ammunition < self.maxAmmo) { self.isReloading = true; LK.getSound('reload').play(); LK.setTimeout(function () { self.ammunition = self.maxAmmo; self.isReloading = false; }, self.reloadTime); } }; self.canShoot = function () { return self.ammunition > 0 && !self.isReloading; }; self.shoot = function () { if (self.canShoot()) { self.ammunition--; if (self.ammunition === 0) { self.reload(); } return true; } return false; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2C3E50 }); /**** * Game Code ****/ var player; var enemies = []; var bullets = []; var enemySpawnTimer = 0; var enemySpawnRate = 180; var gameStarted = false; var lastTapTime = 0; var tapCooldown = 150; var mouseX = 2048 / 2; var mouseY = 2732 / 2; var bosses = []; var lastBossScore = 0; var bossActive = false; // UI Elements var healthText = new Text2('Health: 100', { size: 60, fill: 0xFFFFFF }); healthText.anchor.set(0, 0); LK.gui.topLeft.addChild(healthText); healthText.x = 120; healthText.y = 50; var ammoText = new Text2('Ammo: 30/30', { size: 60, fill: 0xFFFFFF }); ammoText.anchor.set(0, 0); LK.gui.topLeft.addChild(ammoText); ammoText.x = 120; ammoText.y = 120; var scoreText = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); // High Score display in top right var highScore = storage.highScore || 0; var highScoreText = new Text2('High Score: ' + highScore, { size: 60, fill: 0xFFD700 }); highScoreText.anchor.set(1, 0); LK.gui.topRight.addChild(highScoreText); highScoreText.x = -20; highScoreText.y = 20; // +10 Score button below score text var scoreButtonBackground = LK.getAsset('buttonBackground', { anchorX: 0.5, anchorY: 0.5, alpha: 0.7 }); scoreButtonBackground.y = 140; LK.gui.top.addChild(scoreButtonBackground); var scoreButton = new Text2('+10 Score', { size: 60, fill: 0x00FF00 }); scoreButton.anchor.set(0.5, 0); LK.gui.top.addChild(scoreButton); scoreButton.y = 100; // Initialize player player = game.addChild(new Player()); player.x = 2048 / 2; player.y = 2732 / 2; // Movement controls var movementKeys = { up: false, down: false, left: false, right: false }; // Create virtual joystick areas for mobile var moveUpArea = LK.getAsset('player_up', { anchorX: 0.5, anchorY: 0.5, alpha: 0.3, scaleX: 2, scaleY: 1 }); moveUpArea.x = 200; moveUpArea.y = 2400; game.addChild(moveUpArea); var moveDownArea = LK.getAsset('player_up', { anchorX: 0.5, anchorY: 0.5, alpha: 0.3, scaleX: 2, scaleY: 1 }); moveDownArea.x = 200; moveDownArea.y = 2600; game.addChild(moveDownArea); var moveLeftArea = LK.getAsset('player_up', { anchorX: 0.5, anchorY: 0.5, alpha: 0.3, scaleX: 1, scaleY: 2 }); moveLeftArea.x = 100; moveLeftArea.y = 2500; game.addChild(moveLeftArea); var moveRightArea = LK.getAsset('player_up', { anchorX: 0.5, anchorY: 0.5, alpha: 0.3, scaleX: 1, scaleY: 2 }); moveRightArea.x = 300; moveRightArea.y = 2500; game.addChild(moveRightArea); // Movement control handlers moveUpArea.down = function () { movementKeys.up = true; }; moveUpArea.up = function () { movementKeys.up = false; }; moveDownArea.down = function () { movementKeys.down = true; }; moveDownArea.up = function () { movementKeys.down = false; }; moveLeftArea.down = function () { movementKeys.left = true; }; moveLeftArea.up = function () { movementKeys.left = false; }; moveRightArea.down = function () { movementKeys.right = true; }; moveRightArea.up = function () { movementKeys.right = false; }; function spawnEnemy() { var enemy = new Enemy(); // Calculate speed multiplier based on score (10% faster every 10 points) var speedMultiplier = 1 + Math.floor(LK.getScore() / 10) * 0.1; enemy.speed = enemy.speed * speedMultiplier; var side = Math.floor(Math.random() * 4); switch (side) { case 0: // Top enemy.x = Math.random() * 2048; enemy.y = -25; break; case 1: // Right enemy.x = 2073; enemy.y = Math.random() * 2732; break; case 2: // Bottom enemy.x = Math.random() * 2048; enemy.y = 2757; break; case 3: // Left enemy.x = -25; enemy.y = Math.random() * 2732; break; } enemies.push(enemy); game.addChild(enemy); } function spawnBoss() { var boss = new Boss(); var side = Math.floor(Math.random() * 4); switch (side) { case 0: // Top boss.x = Math.random() * 2048; boss.y = -50; break; case 1: // Right boss.x = 2098; boss.y = Math.random() * 2732; break; case 2: // Bottom boss.x = Math.random() * 2048; boss.y = 2782; break; case 3: // Left boss.x = -50; boss.y = Math.random() * 2732; break; } bosses.push(boss); game.addChild(boss); bossActive = true; LK.playMusic('bossMusic'); } function fireBullet(targetX, targetY) { if (player.shoot()) { var bullet = new Bullet(); bullet.x = player.x; bullet.y = player.y; bullet.setDirection(targetX, targetY); bullets.push(bullet); game.addChild(bullet); LK.getSound('shoot').play(); } } // Mouse/touch tracking for player direction game.move = function (x, y, obj) { mouseX = x; mouseY = y; // Calculate direction from player to mouse var dx = mouseX - player.x; var dy = mouseY - player.y; // Determine which direction is dominant if (Math.abs(dx) > Math.abs(dy)) { // Horizontal movement is dominant if (dx > 0) { player.setDirection('right'); } else { player.setDirection('left'); } } else { // Vertical movement is dominant if (dy > 0) { player.setDirection('down'); } else { player.setDirection('up'); } } }; // Score button click handler scoreButton.down = function (x, y, obj) { LK.setScore(LK.getScore() + 10); scoreText.setText('Score: ' + LK.getScore()); // Update high score if current score is higher if (LK.getScore() > highScore) { highScore = LK.getScore(); storage.highScore = highScore; highScoreText.setText('High Score: ' + highScore); } }; // Score button background click handler scoreButtonBackground.down = function (x, y, obj) { LK.setScore(LK.getScore() + 10); scoreText.setText('Score: ' + LK.getScore()); // Update high score if current score is higher if (LK.getScore() > highScore) { highScore = LK.getScore(); storage.highScore = highScore; highScoreText.setText('High Score: ' + highScore); } }; // Shooting controls game.down = function (x, y, obj) { var currentTime = Date.now(); if (currentTime - lastTapTime > tapCooldown) { mouseX = x; mouseY = y; // Update direction when shooting var dx = mouseX - player.x; var dy = mouseY - player.y; if (Math.abs(dx) > Math.abs(dy)) { if (dx > 0) { player.setDirection('right'); } else { player.setDirection('left'); } } else { if (dy > 0) { player.setDirection('down'); } else { player.setDirection('up'); } } fireBullet(x, y); lastTapTime = currentTime; } }; // Main game loop game.update = function () { if (!player) return; // Player movement if (movementKeys.up && player.y > 30) { player.y -= player.speed; } if (movementKeys.down && player.y < 2702) { player.y += player.speed; } if (movementKeys.left && player.x > 30) { player.x -= player.speed; } if (movementKeys.right && player.x < 2018) { player.x += player.speed; } // Spawn enemies enemySpawnTimer++; if (enemySpawnTimer >= enemySpawnRate) { spawnEnemy(); enemySpawnTimer = 0; // Increase difficulty over time if (enemySpawnRate > 60) { enemySpawnRate--; } } // Check for boss spawn every 25 points if (LK.getScore() > 0 && LK.getScore() % 25 === 0 && LK.getScore() !== lastBossScore && !bossActive) { spawnBoss(); lastBossScore = LK.getScore(); } // Update bullets for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; if (bullet.isExpired()) { bullet.destroy(); bullets.splice(i, 1); continue; } // Check bullet-enemy collisions for (var j = enemies.length - 1; j >= 0; j--) { var enemy = enemies[j]; if (bullet.intersects(enemy)) { if (enemy.takeDamage()) { LK.setScore(LK.getScore() + 1); scoreText.setText('Score: ' + LK.getScore()); // Update high score if current score is higher if (LK.getScore() > highScore) { highScore = LK.getScore(); storage.highScore = highScore; highScoreText.setText('High Score: ' + highScore); } LK.getSound('enemyHit').play(); enemy.destroy(); enemies.splice(j, 1); } bullet.destroy(); bullets.splice(i, 1); break; } } // Check bullet-boss collisions for (var b = bosses.length - 1; b >= 0; b--) { var boss = bosses[b]; if (bullet.intersects(boss)) { if (boss.takeDamage()) { LK.setScore(LK.getScore() + 10); scoreText.setText('Score: ' + LK.getScore()); // Update high score if current score is higher if (LK.getScore() > highScore) { highScore = LK.getScore(); storage.highScore = highScore; highScoreText.setText('High Score: ' + highScore); } LK.getSound('bossDeath').play(); boss.destroy(); bosses.splice(b, 1); bossActive = false; LK.stopMusic(); } bullet.destroy(); bullets.splice(i, 1); break; } } } // Check player-enemy collisions for (var k = enemies.length - 1; k >= 0; k--) { var enemy = enemies[k]; if (player.intersects(enemy)) { player.takeDamage(100); break; } } // Check player-boss collisions for (var m = bosses.length - 1; m >= 0; m--) { var boss = bosses[m]; if (player.intersects(boss)) { player.takeDamage(100); break; } } // Update UI healthText.setText('Health: ' + player.health); if (player.isReloading) { ammoText.setText('Reloading...'); } else { ammoText.setText('Ammo: ' + player.ammunition + '/' + player.maxAmmo); } };
===================================================================
--- original.js
+++ change.js
@@ -251,8 +251,15 @@
LK.gui.topRight.addChild(highScoreText);
highScoreText.x = -20;
highScoreText.y = 20;
// +10 Score button below score text
+var scoreButtonBackground = LK.getAsset('buttonBackground', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.7
+});
+scoreButtonBackground.y = 140;
+LK.gui.top.addChild(scoreButtonBackground);
var scoreButton = new Text2('+10 Score', {
size: 60,
fill: 0x00FF00
});
@@ -442,8 +449,19 @@
storage.highScore = highScore;
highScoreText.setText('High Score: ' + highScore);
}
};
+// Score button background click handler
+scoreButtonBackground.down = function (x, y, obj) {
+ LK.setScore(LK.getScore() + 10);
+ scoreText.setText('Score: ' + LK.getScore());
+ // Update high score if current score is higher
+ if (LK.getScore() > highScore) {
+ highScore = LK.getScore();
+ storage.highScore = highScore;
+ highScoreText.setText('High Score: ' + highScore);
+ }
+};
// Shooting controls
game.down = function (x, y, obj) {
var currentTime = Date.now();
if (currentTime - lastTapTime > tapCooldown) {
@@ -542,9 +560,9 @@
highScore = LK.getScore();
storage.highScore = highScore;
highScoreText.setText('High Score: ' + highScore);
}
- LK.getSound('enemyHit').play();
+ LK.getSound('bossDeath').play();
boss.destroy();
bosses.splice(b, 1);
bossActive = false;
LK.stopMusic();
terrorist sketch 1. In-Game asset. 2d. High contrast. No shadows
Bullet. In-Game asset. 2d. High contrast. No shadows
boss sketch ballistic shield. In-Game asset. 2d. High contrast. No shadows
angry devil golem holding a big shield on right hand. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
red big monster dragon sketch. In-Game asset. 2d. High contrast. No shadows
god sketch. 3d model In-Game asset. 2d. High contrast. No shadows
dust 2 dark. In-Game asset. 2d. High contrast. No shadows
black smg icon with white stroke. In-Game asset. 2d. High contrast. No shadows
black sniper icon with white stroke. In-Game asset. 2d. High contrast. No shadows
black shotgun icon with white stroke. In-Game asset. 2d. High contrast. No shadows