User prompt
enemy death after 250 hits
User prompt
add background
User prompt
peluru bos menyebar 3 saat tembakkan
User prompt
peluru musuh menyebar dua setiap tembak
User prompt
jangkauan peluru musub tambah jauh
User prompt
peluru musuh bergerak cepat
User prompt
tap layar berulang di mana saja agar karakter yang dimainkan bisa lompat
User prompt
pergerakkan boss buat cekup pelan
User prompt
pergerakkan boss sampai ke layar bawah
User prompt
pergerakkan boss lebih jauh ke atas dan kebawah
User prompt
buat pakai level. tambah naik level tambah susah dikalahkan
User prompt
hilangkan asset platform
User prompt
player bisa lompat tak terbatas
User prompt
player bisa 7 x jump. player auto shooter. musuh bisa menembak ke arah musuh
User prompt
buat game side scrolling action platform. random generate platform. jumping and shooting boss enemy
Code edit (1 edits merged)
Please save this source code
User prompt
Jet Fighter vs Godzilla
Initial prompt
buat game pesawat canggih bertempur dengan godzilla. godzilla menyerang dengan semburan api
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Boss = Container.expand(function () { var self = Container.call(this); var bossGraphics = self.attachAsset('boss', { anchorX: 0.5, anchorY: 0.5 }); self.health = 20; self.maxHealth = 20; self.shootTimer = 0; self.shootInterval = 90; // 1.5 seconds at 60fps self.moveTimer = 0; self.moveDirection = 1; self.baseY = self.y; self.update = function () { // Boss movement pattern self.moveTimer++; self.y = self.baseY + Math.sin(self.moveTimer * 0.02) * 1300; // Shooting pattern self.shootTimer++; if (self.shootTimer >= self.shootInterval) { self.shoot(); self.shootTimer = 0; } // Flash when hit if (self.hitFlash > 0) { self.hitFlash--; bossGraphics.tint = self.hitFlash % 10 < 5 ? 0xff0000 : 0xffffff; } else { bossGraphics.tint = 0xffffff; } }; self.hitFlash = 0; self.shoot = function () { LK.getSound('bossShoot').play(); // Create boss bullet aimed at player var bullet = new BossBullet(); bullet.x = self.x - 150; bullet.y = self.y; // Calculate direction to player var deltaX = player.x - bullet.x; var deltaY = player.y - bullet.y; var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); var speed = 6; bullet.speedX = deltaX / distance * speed; bullet.speedY = deltaY / distance * speed; bossBullets.push(bullet); game.addChild(bullet); // Flash effect tween(bossGraphics, { scaleX: 1.2, scaleY: 1.2 }, { duration: 100, onFinish: function onFinish() { tween(bossGraphics, { scaleX: 1, scaleY: 1 }, { duration: 100 }); } }); }; self.takeDamage = function () { self.health--; self.hitFlash = 30; LK.getSound('hit').play(); if (self.health <= 0) { // Level up instead of winning currentLevel++; score += 100; // Bonus for completing level LK.setScore(score); // Spawn new boss with increased difficulty self.destroy(); spawnNewBoss(); } }; return self; }); var BossBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bossBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = 0; self.speedY = 0; self.lifetime = 0; self.maxLifetime = 300; self.update = function () { self.x += self.speedX; self.y += self.speedY; self.lifetime++; if (self.lifetime >= self.maxLifetime || self.x < -50) { self.shouldDestroy = true; } }; 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 = 12; self.lifetime = 0; self.maxLifetime = 300; // 5 seconds at 60fps self.update = function () { self.x += self.speed; self.lifetime++; if (self.lifetime >= self.maxLifetime || self.x > 2200) { self.shouldDestroy = true; } }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.velocityY = 0; self.gravity = 0.8; self.jumpPower = -15; self.isGrounded = false; self.isDead = false; self.moveSpeed = 6; self.shootCooldown = 0; self.lastGrounded = false; self.jumpsRemaining = 7; self.maxJumps = 7; self.update = function () { // Apply gravity if (!self.isGrounded) { self.velocityY += self.gravity; } // Apply vertical movement self.y += self.velocityY; // Ground collision detection self.isGrounded = false; // Ground floor collision if (self.y > 2600) { self.y = 2600; self.velocityY = 0; self.isGrounded = true; } // Landing sound effect if (!self.lastGrounded && self.isGrounded && self.velocityY >= 0) { LK.getSound('jump').play(); } self.lastGrounded = self.isGrounded; // Boundary checking if (self.x < 30) self.x = 30; if (self.x > 800) self.x = 800; // Keep player on left side of screen if (self.y < 30) self.y = 30; // Reduce shoot cooldown if (self.shootCooldown > 0) { self.shootCooldown--; } // Auto-shooting if (self.shootCooldown <= 0) { self.shoot(); } }; self.jump = function () { self.velocityY = self.jumpPower; self.isGrounded = false; LK.getSound('jump').play(); }; self.shoot = function () { if (self.shootCooldown <= 0) { var bullet = new Bullet(); bullet.x = self.x + 30; bullet.y = self.y; bullets.push(bullet); game.addChild(bullet); self.shootCooldown = 15; // Quarter second cooldown LK.getSound('shoot').play(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87ceeb }); /**** * Game Code ****/ var player; var boss; var bullets = []; var bossBullets = []; var score = 0; var scrollSpeed = 2; var gameStarted = false; var currentLevel = 1; // UI elements var scoreTxt = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var healthTxt = new Text2('Boss Health: 20', { size: 60, fill: 0xFF0000 }); healthTxt.anchor.set(0, 0); healthTxt.x = 120; healthTxt.y = 20; LK.gui.topLeft.addChild(healthTxt); var levelTxt = new Text2('Level: 1', { size: 60, fill: 0x00FF00 }); levelTxt.anchor.set(1, 0); levelTxt.x = 2048 - 120; levelTxt.y = 20; LK.gui.topRight.addChild(levelTxt); // Initialize game objects function initializeGame() { // Create player player = game.addChild(new Player()); player.x = 200; player.y = 2500; // Create boss using spawn function spawnNewBoss(); // Start background music LK.playMusic('gameMusic'); gameStarted = true; } // Touch controls for jumping and shooting var jumpPressed = false; var shootPressed = false; game.down = function (x, y, obj) { if (!gameStarted || player.isDead) return; if (y > 2200) { // Bottom half of screen for jumping if (!jumpPressed) { player.jump(); jumpPressed = true; } } else { // Top half of screen for shooting if (!shootPressed) { player.shoot(); shootPressed = true; } } }; game.up = function (x, y, obj) { jumpPressed = false; shootPressed = false; }; // Main game update game.update = function () { if (!gameStarted || player.isDead) return; // Update bullets for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; if (bullet.shouldDestroy) { bullet.destroy(); bullets.splice(i, 1); continue; } // Check bullet vs boss collision if (bullet.intersects(boss)) { boss.takeDamage(); bullet.destroy(); bullets.splice(i, 1); score += 10; LK.setScore(score); } } // Update boss bullets for (var i = bossBullets.length - 1; i >= 0; i--) { var bossBullet = bossBullets[i]; if (bossBullet.shouldDestroy) { bossBullet.destroy(); bossBullets.splice(i, 1); continue; } // Check boss bullet vs player collision if (bossBullet.intersects(player) && !player.isDead) { player.isDead = true; // Player death effect LK.effects.flashScreen(0xff0000, 1000); tween(player, { scaleX: 2, scaleY: 2, alpha: 0 }, { duration: 1000, easing: tween.easeOut, onFinish: function onFinish() { LK.showGameOver(); } }); } } // Update UI scoreTxt.setText('Score: ' + score); if (boss && boss.health !== undefined) { healthTxt.setText('Boss Health: ' + boss.health); } levelTxt.setText('Level: ' + currentLevel); // Check if player falls off screen if (player.y > 2800) { player.isDead = true; LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }; // Spawn new boss with level-based difficulty function spawnNewBoss() { boss = game.addChild(new Boss()); boss.x = 1700; boss.y = 1000; boss.baseY = boss.y; // Increase difficulty based on level boss.maxHealth = 20 + (currentLevel - 1) * 10; // +10 health per level boss.health = boss.maxHealth; boss.shootInterval = Math.max(30, 90 - (currentLevel - 1) * 10); // Faster shooting, minimum 0.5 seconds } // Initialize the game initializeGame(); ;
===================================================================
--- original.js
+++ change.js
@@ -21,9 +21,9 @@
self.baseY = self.y;
self.update = function () {
// Boss movement pattern
self.moveTimer++;
- self.y = self.baseY + Math.sin(self.moveTimer * 0.05) * 1300;
+ self.y = self.baseY + Math.sin(self.moveTimer * 0.02) * 1300;
// Shooting pattern
self.shootTimer++;
if (self.shootTimer >= self.shootInterval) {
self.shoot();
monglkey king raja kera di atas awan kinton menyerang dengan tongkat sakti. side scroller image. In-Game asset. 2d. High contrast. No shadows
erlang shen. the sun wukong enemy. side scroller image. atack with fire In-Game asset. 2d. High contrast. No shadows
dari jauh terlihat istana langit di atas awan luas versi fantasy china. In-Game asset. 2d. High contrast. No shadows