User prompt
kahve bardağını oyundan tamamen kaldır
User prompt
upgrade yazısını kaldır
User prompt
kaktüs2 öldürüldüğünde 20 altın kazanalım
User prompt
Sağ üste mavi bir buton koy yanında 0dan başlayan bir sayaç olsun o butona her tıkladığımızda 10 altınımız gitsin ve bir dahakine bastığımızda daha önce bastığımızda verdiğimiz altın miktarının 10 altın fazlasını verelim ve her bastığımızda mermi sıkma hızımız 10 salise artsın ve yanındaki sayaç 1er 1er artsın
User prompt
mermi bir kaktüse çarptığında yok olsun
User prompt
bazı mermiler oldukları yerde kala veriyor bunu düzelt tüm spawnlanan mermilerin hepsi düşmanlara gidecek
User prompt
oyunu optimize et
User prompt
kahvenin 10 salisede bir mermi atmasını 30a çıkaralım
User prompt
kahvenin çıkma şansını yüzde 3e düşür
User prompt
yüzde 15 şansla kaktüslerden çıkan 10 saniye boyunca 10 salisede bir mermi atmamızı yarıyan bir kafve bardağı oluştur ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
kaktüs ve kaktüs2 her dalga yavaş yavaş sayıları artsın
User prompt
kaktüs2 3. dalgada gelsin bize deydiğinde 2 hasar versin ve 2 mermide yok olsun
User prompt
3. dalgada daha güçlü bize değerse 2 hasar veren ve 2 vuruşta ölen daha büyük bir kaktüs gelsin
User prompt
tüm mermiler ne olursa olsun hareket etsin
User prompt
hasar almamanın çıkma şansını yüzde 5
User prompt
saniyede bir mermi sıkalım
User prompt
sıktığımız mermiler en yakın kaktüse gitsin
User prompt
Kaktüsler biz hareket ederkende bize kitlensinler
User prompt
hasar almamanın süresini 10 saniye yapalım
Code edit (1 edits merged)
Please save this source code
User prompt
Sheriff's Last Stand
Initial prompt
vahşi batıda sağımızdan solumuzdan aşağımızdan ve üstümüzden bizim üstümüze gelen kaktüsler ve bize deydiğinde 1 hasar aldığımız ve toplam 10 hasar aldığımızda oyunun bittiği ve yüzde 15 şansla parlayan üstüne gidince 30 saniye boyunca hasar almadığımız bir şerif yıldızı çıkan ve üstüne git dikten sonra yok olan ve elimizdeki tabancayla mermi sıkıp üstümüze gelen kaktüsleri öldürdüğümüz ve altın kazandığımız ve olup biten dalgaların olduğu ve bizim bir şerifi kontrol ettiğimiz bir oyun tasarla
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var BigCactus = Container.expand(function () { var self = Container.call(this); var cactusGraphics = self.attachAsset('kaktus2', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2; self.health = 2; self.direction = { x: 0, y: 0 }; self.lastIntersectingSheriff = false; self.update = function () { // Recalculate direction to always track sheriff's current position var dx = sheriff.x - self.x; var dy = sheriff.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.direction.x = dx / distance; self.direction.y = dy / distance; } self.x += self.direction.x * self.speed; self.y += self.direction.y * self.speed; // Check collision with sheriff var currentIntersecting = self.intersects(sheriff); if (!self.lastIntersectingSheriff && currentIntersecting) { sheriff.takeDamage(2); // Deal 2 damage self.destroy(); var index = bigCacti.indexOf(self); if (index > -1) { bigCacti.splice(index, 1); } } self.lastIntersectingSheriff = currentIntersecting; }; self.takeDamage = function () { self.health--; if (self.health <= 0) { // 3% chance to spawn coffee cup if (Math.random() < 0.03) { spawnCoffeeCup(); } self.destroy(); var index = bigCacti.indexOf(self); if (index > -1) { bigCacti.splice(index, 1); } // Add gold LK.setScore(LK.getScore() + 20); scoreText.setText('Gold: ' + LK.getScore()); } }; 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.direction = { x: 0, y: 0 }; self.lastY = 0; self.lastX = 0; self.update = function () { self.lastX = self.x; self.lastY = self.y; self.x += self.direction.x * self.speed; self.y += self.direction.y * self.speed; }; return self; }); var Cactus = Container.expand(function () { var self = Container.call(this); var cactusGraphics = self.attachAsset('cactus', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2; self.direction = { x: 0, y: 0 }; self.lastIntersectingSheriff = false; self.update = function () { // Recalculate direction to always track sheriff's current position var dx = sheriff.x - self.x; var dy = sheriff.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.direction.x = dx / distance; self.direction.y = dy / distance; } self.x += self.direction.x * self.speed; self.y += self.direction.y * self.speed; // Check collision with sheriff var currentIntersecting = self.intersects(sheriff); if (!self.lastIntersectingSheriff && currentIntersecting) { sheriff.takeDamage(); self.destroy(); var index = cacti.indexOf(self); if (index > -1) { cacti.splice(index, 1); } } self.lastIntersectingSheriff = currentIntersecting; }; return self; }); var CoffeeCup = Container.expand(function () { var self = Container.call(this); var coffeeGraphics = self.attachAsset('coffee', { anchorX: 0.5, anchorY: 0.5 }); self.lastIntersectingSheriff = false; self.update = function () { // Rotate the coffee cup coffeeGraphics.rotation += 0.05; // Check collision with sheriff var currentIntersecting = self.intersects(sheriff); if (!self.lastIntersectingSheriff && currentIntersecting) { sheriff.activateRapidFire(); self.destroy(); var index = coffeeCups.indexOf(self); if (index > -1) { coffeeCups.splice(index, 1); } } self.lastIntersectingSheriff = currentIntersecting; }; return self; }); var GoldenStar = Container.expand(function () { var self = Container.call(this); var starGraphics = self.attachAsset('goldenStar', { anchorX: 0.5, anchorY: 0.5 }); self.lastIntersectingSheriff = false; self.update = function () { // Rotate the star starGraphics.rotation += 0.1; // Check collision with sheriff var currentIntersecting = self.intersects(sheriff); if (!self.lastIntersectingSheriff && currentIntersecting) { sheriff.activateInvincibility(); self.destroy(); var index = goldenStars.indexOf(self); if (index > -1) { goldenStars.splice(index, 1); } } self.lastIntersectingSheriff = currentIntersecting; }; return self; }); var Sheriff = Container.expand(function () { var self = Container.call(this); var sheriffGraphics = self.attachAsset('sheriff', { anchorX: 0.5, anchorY: 0.5 }); self.health = 10; self.invincible = false; self.invincibilityEndTime = 0; self.rapidFire = false; self.rapidFireEndTime = 0; self.update = function () { // Check if invincibility expired if (self.invincible && LK.ticks > self.invincibilityEndTime) { self.invincible = false; sheriffGraphics.tint = 0xFFFFFF; // Reset tint } // Check if rapid fire expired if (self.rapidFire && LK.ticks > self.rapidFireEndTime) { self.rapidFire = false; } // Flash effect when invincible if (self.invincible) { var flashValue = Math.sin(LK.ticks * 0.3) > 0 ? 0xFFD700 : 0xFFFFFF; sheriffGraphics.tint = flashValue; } }; self.takeDamage = function (damage) { if (!self.invincible) { damage = damage || 1; // Default to 1 damage if not specified self.health -= damage; LK.getSound('hit').play(); // Flash red briefly sheriffGraphics.tint = 0xFF0000; LK.setTimeout(function () { if (!self.invincible) { sheriffGraphics.tint = 0xFFFFFF; } }, 200); if (self.health <= 0) { LK.showGameOver(); } } }; self.activateInvincibility = function () { self.invincible = true; self.invincibilityEndTime = LK.ticks + 600; // 10 seconds at 60fps LK.getSound('powerup').play(); }; self.activateRapidFire = function () { self.rapidFire = true; self.rapidFireEndTime = LK.ticks + 600; // 10 seconds at 60fps LK.getSound('powerup').play(); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xDEB887 }); /**** * Game Code ****/ var sheriff = game.addChild(new Sheriff()); sheriff.x = 1024; sheriff.y = 1366; var cacti = []; var bullets = []; var goldenStars = []; var bigCacti = []; var coffeeCups = []; var waveNumber = 1; var cactusSpawnRate = 120; // frames between spawns var cactusSpeed = 2; var dragNode = null; var lastShootTime = 0; var shootInterval = 60; // 60 frames = 1 second at 60fps // UI Elements var healthText = new Text2('Health: 10', { size: 60, fill: 0xFF0000 }); healthText.anchor.set(0, 0); LK.gui.topRight.addChild(healthText); var scoreText = new Text2('Gold: 0', { size: 60, fill: 0xFFD700 }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); var invincibilityText = new Text2('', { size: 50, fill: 0xFFD700 }); invincibilityText.anchor.set(0.5, 0); invincibilityText.y = 80; LK.gui.top.addChild(invincibilityText); var rapidFireText = new Text2('', { size: 50, fill: 0xFF8C00 }); rapidFireText.anchor.set(0.5, 0); rapidFireText.y = 140; LK.gui.top.addChild(rapidFireText); var waveText = new Text2('Wave: 1', { size: 50, fill: 0xFFFFFF }); waveText.anchor.set(0, 0); LK.gui.topLeft.addChild(waveText); waveText.x = 120; // Offset to avoid menu icon function spawnCactus() { var cactus = new Cactus(); var side = Math.floor(Math.random() * 4); switch (side) { case 0: // Top cactus.x = Math.random() * 2048; cactus.y = -30; cactus.direction.x = (sheriff.x - cactus.x) / Math.sqrt((sheriff.x - cactus.x) * (sheriff.x - cactus.x) + (sheriff.y - cactus.y) * (sheriff.y - cactus.y)); cactus.direction.y = (sheriff.y - cactus.y) / Math.sqrt((sheriff.x - cactus.x) * (sheriff.x - cactus.x) + (sheriff.y - cactus.y) * (sheriff.y - cactus.y)); break; case 1: // Right cactus.x = 2078; cactus.y = Math.random() * 2732; cactus.direction.x = (sheriff.x - cactus.x) / Math.sqrt((sheriff.x - cactus.x) * (sheriff.x - cactus.x) + (sheriff.y - cactus.y) * (sheriff.y - cactus.y)); cactus.direction.y = (sheriff.y - cactus.y) / Math.sqrt((sheriff.x - cactus.x) * (sheriff.x - cactus.x) + (sheriff.y - cactus.y) * (sheriff.y - cactus.y)); break; case 2: // Bottom cactus.x = Math.random() * 2048; cactus.y = 2762; cactus.direction.x = (sheriff.x - cactus.x) / Math.sqrt((sheriff.x - cactus.x) * (sheriff.x - cactus.x) + (sheriff.y - cactus.y) * (sheriff.y - cactus.y)); cactus.direction.y = (sheriff.y - cactus.y) / Math.sqrt((sheriff.x - cactus.x) * (sheriff.x - cactus.x) + (sheriff.y - cactus.y) * (sheriff.y - cactus.y)); break; case 3: // Left cactus.x = -30; cactus.y = Math.random() * 2732; cactus.direction.x = (sheriff.x - cactus.x) / Math.sqrt((sheriff.x - cactus.x) * (sheriff.x - cactus.x) + (sheriff.y - cactus.y) * (sheriff.y - cactus.y)); cactus.direction.y = (sheriff.y - cactus.y) / Math.sqrt((sheriff.x - cactus.x) * (sheriff.x - cactus.x) + (sheriff.y - cactus.y) * (sheriff.y - cactus.y)); break; } cactus.speed = cactusSpeed; cacti.push(cactus); game.addChild(cactus); } function spawnBigCactus() { var bigCactus = new BigCactus(); var side = Math.floor(Math.random() * 4); switch (side) { case 0: // Top bigCactus.x = Math.random() * 2048; bigCactus.y = -30; bigCactus.direction.x = (sheriff.x - bigCactus.x) / Math.sqrt((sheriff.x - bigCactus.x) * (sheriff.x - bigCactus.x) + (sheriff.y - bigCactus.y) * (sheriff.y - bigCactus.y)); bigCactus.direction.y = (sheriff.y - bigCactus.y) / Math.sqrt((sheriff.x - bigCactus.x) * (sheriff.x - bigCactus.x) + (sheriff.y - bigCactus.y) * (sheriff.y - bigCactus.y)); break; case 1: // Right bigCactus.x = 2078; bigCactus.y = Math.random() * 2732; bigCactus.direction.x = (sheriff.x - bigCactus.x) / Math.sqrt((sheriff.x - bigCactus.x) * (sheriff.x - bigCactus.x) + (sheriff.y - bigCactus.y) * (sheriff.y - bigCactus.y)); bigCactus.direction.y = (sheriff.y - bigCactus.y) / Math.sqrt((sheriff.x - bigCactus.x) * (sheriff.x - bigCactus.x) + (sheriff.y - bigCactus.y) * (sheriff.y - bigCactus.y)); break; case 2: // Bottom bigCactus.x = Math.random() * 2048; bigCactus.y = 2762; bigCactus.direction.x = (sheriff.x - bigCactus.x) / Math.sqrt((sheriff.x - bigCactus.x) * (sheriff.x - bigCactus.x) + (sheriff.y - bigCactus.y) * (sheriff.y - bigCactus.y)); bigCactus.direction.y = (sheriff.y - bigCactus.y) / Math.sqrt((sheriff.x - bigCactus.x) * (sheriff.x - bigCactus.x) + (sheriff.y - bigCactus.y) * (sheriff.y - bigCactus.y)); break; case 3: // Left bigCactus.x = -30; bigCactus.y = Math.random() * 2732; bigCactus.direction.x = (sheriff.x - bigCactus.x) / Math.sqrt((sheriff.x - bigCactus.x) * (sheriff.x - bigCactus.x) + (sheriff.y - bigCactus.y) * (sheriff.y - bigCactus.y)); bigCactus.direction.y = (sheriff.y - bigCactus.y) / Math.sqrt((sheriff.x - bigCactus.x) * (sheriff.x - bigCactus.x) + (sheriff.y - bigCactus.y) * (sheriff.y - bigCactus.y)); break; } bigCactus.speed = cactusSpeed; bigCacti.push(bigCactus); game.addChild(bigCactus); } function spawnGoldenStar() { var star = new GoldenStar(); star.x = Math.random() * 1800 + 124; // Keep away from edges star.y = Math.random() * 2400 + 166; goldenStars.push(star); game.addChild(star); } function spawnCoffeeCup() { var coffee = new CoffeeCup(); coffee.x = Math.random() * 1800 + 124; // Keep away from edges coffee.y = Math.random() * 2400 + 166; coffeeCups.push(coffee); game.addChild(coffee); } function shootBullet(targetX, targetY) { var bullet = new Bullet(); bullet.x = sheriff.x; bullet.y = sheriff.y; // Find the nearest cactus (including big cacti) var nearestCactus = null; var nearestDistance = Infinity; for (var i = 0; i < cacti.length; i++) { var cactus = cacti[i]; var dx = cactus.x - sheriff.x; var dy = cactus.y - sheriff.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < nearestDistance) { nearestDistance = distance; nearestCactus = cactus; } } // Also check big cacti for (var i = 0; i < bigCacti.length; i++) { var bigCactus = bigCacti[i]; var dx = bigCactus.x - sheriff.x; var dy = bigCactus.y - sheriff.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < nearestDistance) { nearestDistance = distance; nearestCactus = bigCactus; } } // If there's a nearest cactus, aim at it, otherwise use touch direction if (nearestCactus) { var dx = nearestCactus.x - sheriff.x; var dy = nearestCactus.y - sheriff.y; var distance = Math.sqrt(dx * dx + dy * dy); bullet.direction.x = dx / distance; bullet.direction.y = dy / distance; } else { var dx = targetX - sheriff.x; var dy = targetY - sheriff.y; var distance = Math.sqrt(dx * dx + dy * dy); bullet.direction.x = dx / distance; bullet.direction.y = dy / distance; } bullets.push(bullet); game.addChild(bullet); LK.getSound('shoot').play(); } game.down = function (x, y, obj) { dragNode = sheriff; sheriff.x = x; sheriff.y = y; }; game.move = function (x, y, obj) { if (dragNode) { dragNode.x = x; dragNode.y = y; } }; game.up = function (x, y, obj) { dragNode = null; }; game.update = function () { // Automatic shooting - rapid fire shoots every 6 frames (0.1 seconds), normal shoots every 60 frames (1 second) var currentShootInterval = sheriff.rapidFire ? 6 : shootInterval; if (LK.ticks - lastShootTime >= currentShootInterval) { shootBullet(sheriff.x, sheriff.y); lastShootTime = LK.ticks; } // Spawn cacti - spawn multiple based on wave number if (LK.ticks % cactusSpawnRate === 0) { var cactusesToSpawn = Math.min(waveNumber, 5); // Cap at 5 cacti per spawn for (var c = 0; c < cactusesToSpawn; c++) { spawnCactus(); } } // Spawn big cacti starting from wave 3 - spawn multiple based on wave number if (waveNumber >= 3 && LK.ticks % (cactusSpawnRate * 3) === 0) { var bigCactiToSpawn = Math.min(waveNumber - 2, 3); // Start from wave 3, cap at 3 big cacti per spawn for (var bc = 0; bc < bigCactiToSpawn; bc++) { spawnBigCactus(); } } // Spawn golden stars (5% chance every 3 seconds) if (LK.ticks % 180 === 0 && Math.random() < 0.05) { spawnGoldenStar(); } // Update wave progression var newWave = Math.floor(LK.ticks / 1800) + 1; // New wave every 30 seconds if (newWave > waveNumber) { waveNumber = newWave; cactusSpawnRate = Math.max(30, cactusSpawnRate - 10); // Increase spawn rate cactusSpeed = Math.min(5, cactusSpeed + 0.3); // Increase speed waveText.setText('Wave: ' + waveNumber); } // Update bullets for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; // Check bullet-cactus collisions for (var j = cacti.length - 1; j >= 0; j--) { var cactus = cacti[j]; if (bullet.intersects(cactus)) { // 3% chance to spawn coffee cup if (Math.random() < 0.03) { spawnCoffeeCup(); } // Destroy cactus but keep bullet moving cactus.destroy(); cacti.splice(j, 1); // Add gold LK.setScore(LK.getScore() + 10); scoreText.setText('Gold: ' + LK.getScore()); break; } } // Check bullet-big cactus collisions for (var j = bigCacti.length - 1; j >= 0; j--) { var bigCactus = bigCacti[j]; if (bullet.intersects(bigCactus)) { // Damage big cactus but keep bullet moving bigCactus.takeDamage(); break; } } } // Remove cacti that go too far off screen for (var k = cacti.length - 1; k >= 0; k--) { var cactus = cacti[k]; if (cactus.x < -100 || cactus.x > 2148 || cactus.y < -100 || cactus.y > 2832) { cactus.destroy(); cacti.splice(k, 1); } } // Remove big cacti that go too far off screen for (var k = bigCacti.length - 1; k >= 0; k--) { var bigCactus = bigCacti[k]; if (bigCactus.x < -100 || bigCactus.x > 2148 || bigCactus.y < -100 || bigCactus.y > 2832) { bigCactus.destroy(); bigCacti.splice(k, 1); } } // Update UI healthText.setText('Health: ' + sheriff.health); // Update invincibility timer display if (sheriff.invincible) { var timeLeft = Math.ceil((sheriff.invincibilityEndTime - LK.ticks) / 60); invincibilityText.setText('Invincible: ' + timeLeft + 's'); } else { invincibilityText.setText(''); } // Update rapid fire timer display if (sheriff.rapidFire) { var timeLeft = Math.ceil((sheriff.rapidFireEndTime - LK.ticks) / 60); rapidFireText.setText('Rapid Fire: ' + timeLeft + 's'); } else { rapidFireText.setText(''); } };
===================================================================
--- original.js
+++ change.js
@@ -44,10 +44,10 @@
};
self.takeDamage = function () {
self.health--;
if (self.health <= 0) {
- // 15% chance to spawn coffee cup
- if (Math.random() < 0.15) {
+ // 3% chance to spawn coffee cup
+ if (Math.random() < 0.03) {
spawnCoffeeCup();
}
self.destroy();
var index = bigCacti.indexOf(self);
@@ -469,10 +469,10 @@
// Check bullet-cactus collisions
for (var j = cacti.length - 1; j >= 0; j--) {
var cactus = cacti[j];
if (bullet.intersects(cactus)) {
- // 15% chance to spawn coffee cup
- if (Math.random() < 0.15) {
+ // 3% chance to spawn coffee cup
+ if (Math.random() < 0.03) {
spawnCoffeeCup();
}
// Destroy cactus but keep bullet moving
cactus.destroy();
göğsünde bir şerif yıldızı olan silahlı bir stickman. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
kafalarında kaktüs çiçeği olan 2 kaktüs . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
üçlarında topçuk olan gökkuşağı bir yıldız. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
altın renginde mermi. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
büyük bir kaktüs. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
üzerinde SPEED UP yazan bir buton. In-Game asset. 2d. High contrast. No shadows