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 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 = 2 + Math.random() * 3; self.health = 1; self.update = function () { self.y -= self.speed; }; 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); var shipGraphics = self.attachAsset('ship', { anchorX: 0.5, anchorY: 0.5 }); 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; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x006994 }); /**** * Game Code ****/ var ship; var projectiles = []; var seaMonsters = []; var dragNode = null; var monsterSpawnTimer = 0; var monsterSpawnInterval = 120; // frames 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); var playerHealth = 100; function updateScore() { scoreTxt.setText('Score: ' + LK.getScore()); } function updateHealth() { healthTxt.setText('Health: ' + playerHealth); } function spawnMonster() { var monster = new SeaMonster(); monster.x = Math.random() * (2048 - 100) + 50; monster.y = 2732 + 50; monster.lastY = monster.y; seaMonsters.push(monster); game.addChild(monster); } 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; } // 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('hit').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 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 (top) if (monster.lastY <= -50 && monster.y > -50) { monster.destroy(); seaMonsters.splice(k, 1); continue; } monster.lastY = monster.y; } // Win condition (optional high score target) if (LK.getScore() >= 1000) { LK.showYouWin(); } }; // Start background music LK.playMusic('ocean'); // Initialize displays updateScore(); updateHealth();
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,230 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+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 = 2 + Math.random() * 3;
+ self.health = 1;
+ self.update = function () {
+ self.y -= self.speed;
+ };
+ 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);
+ var shipGraphics = self.attachAsset('ship', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ 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;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x006994
+});
+
+/****
+* Game Code
+****/
+var ship;
+var projectiles = [];
+var seaMonsters = [];
+var dragNode = null;
+var monsterSpawnTimer = 0;
+var monsterSpawnInterval = 120; // frames
+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);
+var playerHealth = 100;
+function updateScore() {
+ scoreTxt.setText('Score: ' + LK.getScore());
+}
+function updateHealth() {
+ healthTxt.setText('Health: ' + playerHealth);
+}
+function spawnMonster() {
+ var monster = new SeaMonster();
+ monster.x = Math.random() * (2048 - 100) + 50;
+ monster.y = 2732 + 50;
+ monster.lastY = monster.y;
+ seaMonsters.push(monster);
+ game.addChild(monster);
+}
+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;
+ }
+ // 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('hit').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 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 (top)
+ if (monster.lastY <= -50 && monster.y > -50) {
+ monster.destroy();
+ seaMonsters.splice(k, 1);
+ continue;
+ }
+ monster.lastY = monster.y;
+ }
+ // Win condition (optional high score target)
+ if (LK.getScore() >= 1000) {
+ LK.showYouWin();
+ }
+};
+// Start background music
+LK.playMusic('ocean');
+// Initialize displays
+updateScore();
+updateHealth();
\ No newline at end of file
İ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