User prompt
Her 100 skorda level artsın
User prompt
Havadan meteor yerine martılar geçsin ve bize çarparsa canımız gitsin
User prompt
Denizde dalga olsun ama dalgalar üstten gelsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Sağlık paketinden sadece 20 can versin
User prompt
Sağlık paketleri olsun onlara vurduğumuzda can kazanalım ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
seaMonsterı öldürdüğümüzde patalama sesi gelsin
User prompt
Köpek balıklarını öldürdüğümüzde patlama sesi gelsin
User prompt
Dalgalar daha gerçekçi olsun ve üstten gelsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Denizin içerisine dalga ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Havadan hızlı bir şekilde meteorlar da gelsin ve Şhip bir teknenin içinde olsun
User prompt
Oyun her 200 skorda level atlasın ve 100 level olsun
User prompt
seaMonsterler dahızlı gelsin ve gelirken bize ateş etsin hızlı bir şekilde ve seaMonster bizi geçerse canımız hgitsin
User prompt
seaMonsterlar havadan gelsin
Code edit (1 edits merged)
Please save this source code
User prompt
Sea Monster Battle
Initial prompt
Bir teknemiz olsun o teknenin içinden denizdeki yaratıklarla savaşalı
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Meteor = Container.expand(function () { var self = Container.call(this); var meteorGraphics = self.attachAsset('meteor', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 15 + Math.random() * 10; // Fast meteors self.rotationSpeed = 0.1 + Math.random() * 0.2; self.update = function () { self.y += self.speed; meteorGraphics.rotation += self.rotationSpeed; }; return self; }); var MonsterBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('projectile', { anchorX: 0.5, anchorY: 0.5 }); bulletGraphics.tint = 0xFF0000; // Red color for monster bullets self.speed = 10; self.update = function () { self.y += self.speed; }; return self; }); var Projectile = Container.expand(function () { var self = Container.call(this); var projectileGraphics = self.attachAsset('projectile', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -12; self.update = function () { self.y += self.speed; }; return self; }); var SeaMonster = Container.expand(function () { var self = Container.call(this); var monsterGraphics = self.attachAsset('seaMonster', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8 + Math.random() * 6; self.health = 1; self.lastShotTime = 0; self.shotCooldown = 600 + Math.random() * 400; // Random shooting interval self.update = function () { self.y += self.speed; // Monster shooting logic if (Date.now() - self.lastShotTime > self.shotCooldown) { self.lastShotTime = Date.now(); var bullet = new MonsterBullet(); bullet.x = self.x; bullet.y = self.y + 50; bullet.lastY = bullet.y; monsterBullets.push(bullet); game.addChild(bullet); } }; self.takeDamage = function () { self.health--; if (self.health <= 0) { LK.effects.flashObject(self, 0xFF0000, 200); return true; // Monster destroyed } return false; }; return self; }); var Ship = Container.expand(function () { var self = Container.call(this); // Add boat graphics first (underneath) var boatGraphics = self.attachAsset('boat', { anchorX: 0.5, anchorY: 0.5 }); // Add ship graphics on top var shipGraphics = self.attachAsset('ship', { anchorX: 0.5, anchorY: 0.3 }); shipGraphics.y = -10; // Position ship slightly above boat self.speed = 8; self.lastShotTime = 0; self.shotCooldown = 300; // milliseconds self.moveLeft = function () { self.x -= self.speed; if (self.x < shipGraphics.width / 2) { self.x = shipGraphics.width / 2; } }; self.moveRight = function () { self.x += self.speed; if (self.x > 2048 - shipGraphics.width / 2) { self.x = 2048 - shipGraphics.width / 2; } }; self.canShoot = function () { return Date.now() - self.lastShotTime > self.shotCooldown; }; self.shoot = function () { if (self.canShoot()) { self.lastShotTime = Date.now(); return true; } return false; }; return self; }); var Wave = Container.expand(function () { var self = Container.call(this); var waveGraphics = self.attachAsset('wave', { anchorX: 0.5, anchorY: 0.5 }); waveGraphics.alpha = 0.6; self.speed = 3 + Math.random() * 4; self.originalX = self.x; self.waveOffset = Math.random() * Math.PI * 2; self.horizontalAmplitude = 30 + Math.random() * 20; self.update = function () { // Move wave downward self.y += self.speed; // Animate wave with realistic horizontal sine wave motion self.x = self.originalX + Math.sin(LK.ticks * 0.03 + self.waveOffset) * self.horizontalAmplitude; // Add subtle scaling animation for wave effect var scaleVariation = 1 + Math.sin(LK.ticks * 0.02 + self.waveOffset) * 0.1; waveGraphics.scaleX = scaleVariation; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x006994 }); /**** * Game Code ****/ var ship; var projectiles = []; var seaMonsters = []; var monsterBullets = []; var meteors = []; var waves = []; var dragNode = null; var waveSpawnTimer = 0; var waveSpawnInterval = 150; // frames between waves var monsterSpawnTimer = 0; var monsterSpawnInterval = 120; // frames var meteorSpawnTimer = 0; var meteorSpawnInterval = 60; // frames - meteors spawn more frequently var difficultyTimer = 0; // Initialize ship ship = game.addChild(new Ship()); ship.x = 2048 / 2; ship.y = 2732 - 150; // Score display var scoreTxt = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Health display var healthTxt = new Text2('Health: 100', { size: 60, fill: 0xFFFFFF }); healthTxt.anchor.set(0, 0); healthTxt.x = 120; healthTxt.y = 20; LK.gui.topLeft.addChild(healthTxt); // Level display var levelTxt = new Text2('Level: 1', { size: 60, fill: 0xFFD700 }); levelTxt.anchor.set(1, 0); levelTxt.x = -20; levelTxt.y = 20; LK.gui.topRight.addChild(levelTxt); var playerHealth = 100; var currentLevel = 1; var maxLevel = 100; var pointsPerLevel = 200; function updateScore() { scoreTxt.setText('Score: ' + LK.getScore()); checkLevelUp(); } function updateHealth() { healthTxt.setText('Health: ' + playerHealth); } function updateLevel() { levelTxt.setText('Level: ' + currentLevel); } function checkLevelUp() { var newLevel = Math.floor(LK.getScore() / pointsPerLevel) + 1; if (newLevel > currentLevel && newLevel <= maxLevel) { currentLevel = newLevel; updateLevel(); // Flash screen gold when leveling up LK.effects.flashScreen(0xFFD700, 800); // Increase difficulty with each level monsterSpawnInterval = Math.max(20, 120 - currentLevel * 2); return true; } return false; } function spawnMonster() { var monster = new SeaMonster(); monster.x = Math.random() * (2048 - 100) + 50; monster.y = -50; monster.lastY = monster.y; seaMonsters.push(monster); game.addChild(monster); } function spawnMeteor() { var meteor = new Meteor(); meteor.x = Math.random() * (2048 - 60) + 30; meteor.y = -60; meteor.lastY = meteor.y; meteors.push(meteor); game.addChild(meteor); } function spawnWave() { var wave = new Wave(); wave.x = Math.random() * 2048; // Random horizontal position wave.y = -80; // Start from top of screen wave.originalX = wave.x; wave.lastY = wave.y; waves.push(wave); game.addChild(wave); // Add realistic wave animation with tween tween(wave, { alpha: 0.8, scaleY: 1.2 }, { duration: 2000, easing: tween.easeInOut }); } function handleMove(x, y, obj) { if (dragNode === ship) { ship.x = x; if (ship.x < 60) ship.x = 60; if (ship.x > 2048 - 60) ship.x = 2048 - 60; } } game.move = handleMove; game.down = function (x, y, obj) { dragNode = ship; handleMove(x, y, obj); }; game.up = function (x, y, obj) { dragNode = null; }; game.update = function () { // Increase difficulty over time difficultyTimer++; if (difficultyTimer % 1800 === 0) { // Every 30 seconds monsterSpawnInterval = Math.max(30, monsterSpawnInterval - 10); } // Spawn monsters monsterSpawnTimer++; if (monsterSpawnTimer >= monsterSpawnInterval) { spawnMonster(); monsterSpawnTimer = 0; } // Spawn meteors meteorSpawnTimer++; if (meteorSpawnTimer >= meteorSpawnInterval) { spawnMeteor(); meteorSpawnTimer = 0; } // Spawn waves waveSpawnTimer++; if (waveSpawnTimer >= waveSpawnInterval) { spawnWave(); waveSpawnTimer = 0; } // Auto-shoot from ship if (ship.shoot()) { var projectile = new Projectile(); projectile.x = ship.x; projectile.y = ship.y - 40; projectile.lastY = projectile.y; projectiles.push(projectile); game.addChild(projectile); LK.getSound('shoot').play(); } // Update and check projectiles for (var i = projectiles.length - 1; i >= 0; i--) { var projectile = projectiles[i]; // Check if projectile went off screen if (projectile.lastY >= -20 && projectile.y < -20) { projectile.destroy(); projectiles.splice(i, 1); continue; } // Check projectile-monster collisions var hit = false; for (var j = seaMonsters.length - 1; j >= 0; j--) { var monster = seaMonsters[j]; if (projectile.intersects(monster)) { if (monster.takeDamage()) { LK.setScore(LK.getScore() + 10); updateScore(); LK.getSound('explosion').play(); monster.destroy(); seaMonsters.splice(j, 1); } projectile.destroy(); projectiles.splice(i, 1); hit = true; break; } } if (!hit) { projectile.lastY = projectile.y; } } // Update and check monster bullets for (var b = monsterBullets.length - 1; b >= 0; b--) { var bullet = monsterBullets[b]; // Check if bullet hit ship if (bullet.intersects(ship)) { playerHealth -= 15; updateHealth(); LK.effects.flashScreen(0xFF0000, 300); bullet.destroy(); monsterBullets.splice(b, 1); if (playerHealth <= 0) { LK.showGameOver(); return; } continue; } // Check if bullet went off screen (bottom) if (bullet.lastY <= 2732 + 20 && bullet.y > 2732 + 20) { bullet.destroy(); monsterBullets.splice(b, 1); continue; } bullet.lastY = bullet.y; } // Update and check sea monsters for (var k = seaMonsters.length - 1; k >= 0; k--) { var monster = seaMonsters[k]; // Check if monster reached ship if (monster.intersects(ship)) { playerHealth -= 20; updateHealth(); LK.effects.flashScreen(0xFF0000, 500); monster.destroy(); seaMonsters.splice(k, 1); if (playerHealth <= 0) { LK.showGameOver(); return; } continue; } // Check if monster went off screen (bottom) - player loses health if (monster.lastY <= 2732 + 50 && monster.y > 2732 + 50) { playerHealth -= 10; // Lose health when monster passes updateHealth(); LK.effects.flashScreen(0xFFFF00, 200); // Yellow flash for passed monster monster.destroy(); seaMonsters.splice(k, 1); if (playerHealth <= 0) { LK.showGameOver(); return; } continue; } monster.lastY = monster.y; } // Update and check meteors for (var m = meteors.length - 1; m >= 0; m--) { var meteor = meteors[m]; // Check if meteor hit ship if (meteor.intersects(ship)) { playerHealth -= 25; // Meteors do significant damage updateHealth(); LK.effects.flashScreen(0xFFA500, 400); // Orange flash for meteor hit meteor.destroy(); meteors.splice(m, 1); if (playerHealth <= 0) { LK.showGameOver(); return; } continue; } // Check if meteor went off screen (bottom) if (meteor.lastY <= 2732 + 60 && meteor.y > 2732 + 60) { meteor.destroy(); meteors.splice(m, 1); continue; } meteor.lastY = meteor.y; } // Update and clean up waves for (var w = waves.length - 1; w >= 0; w--) { var wave = waves[w]; // Check if wave went off screen (bottom) if (wave.lastY <= 2732 + 80 && wave.y > 2732 + 80) { wave.destroy(); waves.splice(w, 1); continue; } wave.lastY = wave.y; } // Win condition - reach level 100 if (currentLevel >= maxLevel) { LK.showYouWin(); } }; // Start background music LK.playMusic('ocean'); // Initialize displays updateScore(); updateHealth(); updateLevel();
===================================================================
--- original.js
+++ change.js
@@ -320,9 +320,9 @@
if (projectile.intersects(monster)) {
if (monster.takeDamage()) {
LK.setScore(LK.getScore() + 10);
updateScore();
- LK.getSound('hit').play();
+ LK.getSound('explosion').play();
monster.destroy();
seaMonsters.splice(j, 1);
}
projectile.destroy();
İnsan. In-Game asset. 2d. High contrast. No shadows
Büyük tekne. In-Game asset. 2d. High contrast. No shadows
Köpek balığı. In-Game asset. 2d. High contrast. No shadows
Deniz dalgası. In-Game asset. 2d. High contrast. No shadows
Sağlık paketi. In-Game asset. 2d. High contrast. No shadows
Martı. In-Game asset. 2d. High contrast. No shadows