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 FireBreath = Container.expand(function () { var self = Container.call(this); var fireGraphics = self.attachAsset('fireBreath', { anchorX: 0.5, anchorY: 0.5 }); self.lifetime = 0; self.maxLifetime = 120; // 2 seconds self.moveSpeed = 4; self.attackPattern = 'horizontal'; self.update = function () { self.lifetime++; // Move fire breath based on pattern if (self.attackPattern === 'horizontal') { self.y -= self.moveSpeed; } else if (self.attackPattern === 'diagonal') { self.y -= self.moveSpeed; self.x += self.moveSpeed * 0.5; } else if (self.attackPattern === 'sweep') { self.y -= self.moveSpeed * 0.3; self.x += Math.sin(self.lifetime * 0.1) * 3; } // Fade out over time if (self.lifetime > self.maxLifetime * 0.5) { var fadeAmount = 1 - (self.lifetime - self.maxLifetime * 0.5) / (self.maxLifetime * 0.5); fireGraphics.alpha = fadeAmount; } // Remove when lifetime expires if (self.lifetime >= self.maxLifetime) { self.shouldDestroy = true; } }; return self; }); var Godzilla = Container.expand(function () { var self = Container.call(this); var godzillaGraphics = self.attachAsset('godzilla', { anchorX: 0.5, anchorY: 1.0 }); self.fireTimer = 0; self.fireInterval = 180; // 3 seconds at 60fps self.isAttacking = false; self.update = function () { self.fireTimer++; if (self.fireTimer >= self.fireInterval && !self.isAttacking) { self.startFireAttack(); } }; self.startFireAttack = function () { self.isAttacking = true; self.fireTimer = 0; // Flash effect when attacking tween(godzillaGraphics, { tint: 0xff0000 }, { duration: 200, onFinish: function onFinish() { tween(godzillaGraphics, { tint: 0xffffff }, { duration: 200, onFinish: function onFinish() { self.isAttacking = false; // Reduce interval for increasing difficulty if (self.fireInterval > 60) { self.fireInterval -= 2; } } }); } }); LK.getSound('fireAttack').play(); // Create fire breath attack createFireAttack(); }; return self; }); var Jet = Container.expand(function () { var self = Container.call(this); var jetGraphics = self.attachAsset('jet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.isDead = false; self.update = function () { // Boundary checking if (self.x < 60) self.x = 60; if (self.x > 2048 - 60) self.x = 2048 - 60; if (self.y < 60) self.y = 60; if (self.y > 2732 - 60) self.y = 2732 - 60; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87ceeb }); /**** * Game Code ****/ var jet; var godzilla; var fireBreaths = []; var dragTarget = null; var survivalTime = 0; var lastColliding = false; // UI elements var scoreTxt = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var timeTxt = new Text2('Time: 0s', { size: 60, fill: 0xFFFFFF }); timeTxt.anchor.set(1, 0); LK.gui.topRight.addChild(timeTxt); // Initialize game objects function initializeGame() { // Create jet jet = game.addChild(new Jet()); jet.x = 1024; jet.y = 2000; // Create Godzilla godzilla = game.addChild(new Godzilla()); godzilla.x = 1024; godzilla.y = 2732; // Start background music LK.playMusic('battleMusic'); } // Create fire attack with random pattern function createFireAttack() { var patterns = ['horizontal', 'diagonal', 'sweep']; var pattern = patterns[Math.floor(Math.random() * patterns.length)]; var numFires = 3 + Math.floor(survivalTime / 1000); // More fires over time if (numFires > 8) numFires = 8; for (var i = 0; i < numFires; i++) { var fire = new FireBreath(); fire.attackPattern = pattern; if (pattern === 'horizontal') { fire.x = 200 + i * 300; fire.y = 2500; } else if (pattern === 'diagonal') { fire.x = 100 + i * 250; fire.y = 2600; } else if (pattern === 'sweep') { fire.x = 300 + i * 200; fire.y = 2400; } fireBreaths.push(fire); game.addChild(fire); // Add some visual flair tween(fire, { scaleX: 1.5, scaleY: 1.5 }, { duration: 300, easing: tween.easeOut }); } } // Touch controls game.down = function (x, y, obj) { dragTarget = jet; if (dragTarget) { dragTarget.x = x; dragTarget.y = y; } }; game.move = function (x, y, obj) { if (dragTarget && !jet.isDead) { dragTarget.x = x; dragTarget.y = y; } }; game.up = function (x, y, obj) { dragTarget = null; }; // Main game update game.update = function () { if (jet.isDead) return; survivalTime += 16.67; // Approximate ms per frame at 60fps // Update score and time display var score = Math.floor(survivalTime / 100); LK.setScore(score); scoreTxt.setText('Score: ' + score); timeTxt.setText('Time: ' + Math.floor(survivalTime / 1000) + 's'); // Check collisions with fire breath var currentlyColliding = false; for (var i = fireBreaths.length - 1; i >= 0; i--) { var fire = fireBreaths[i]; if (fire.shouldDestroy) { fire.destroy(); fireBreaths.splice(i, 1); continue; } // Check collision with jet if (jet.intersects(fire) && !currentlyColliding) { currentlyColliding = true; if (!lastColliding) { // Collision just started jet.isDead = true; // Explosion effect LK.effects.flashScreen(0xff4500, 1000); LK.getSound('explosion').play(); // Jet explosion animation tween(jet, { scaleX: 2, scaleY: 2, alpha: 0 }, { duration: 1000, easing: tween.easeOut, onFinish: function onFinish() { LK.showGameOver(); } }); break; } } } lastColliding = currentlyColliding; // Near miss effect if (!currentlyColliding && lastColliding) { LK.effects.flashObject(jet, 0xffff00, 300); } }; // Initialize the game initializeGame();
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,245 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var FireBreath = Container.expand(function () {
+ var self = Container.call(this);
+ var fireGraphics = self.attachAsset('fireBreath', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.lifetime = 0;
+ self.maxLifetime = 120; // 2 seconds
+ self.moveSpeed = 4;
+ self.attackPattern = 'horizontal';
+ self.update = function () {
+ self.lifetime++;
+ // Move fire breath based on pattern
+ if (self.attackPattern === 'horizontal') {
+ self.y -= self.moveSpeed;
+ } else if (self.attackPattern === 'diagonal') {
+ self.y -= self.moveSpeed;
+ self.x += self.moveSpeed * 0.5;
+ } else if (self.attackPattern === 'sweep') {
+ self.y -= self.moveSpeed * 0.3;
+ self.x += Math.sin(self.lifetime * 0.1) * 3;
+ }
+ // Fade out over time
+ if (self.lifetime > self.maxLifetime * 0.5) {
+ var fadeAmount = 1 - (self.lifetime - self.maxLifetime * 0.5) / (self.maxLifetime * 0.5);
+ fireGraphics.alpha = fadeAmount;
+ }
+ // Remove when lifetime expires
+ if (self.lifetime >= self.maxLifetime) {
+ self.shouldDestroy = true;
+ }
+ };
+ return self;
+});
+var Godzilla = Container.expand(function () {
+ var self = Container.call(this);
+ var godzillaGraphics = self.attachAsset('godzilla', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ self.fireTimer = 0;
+ self.fireInterval = 180; // 3 seconds at 60fps
+ self.isAttacking = false;
+ self.update = function () {
+ self.fireTimer++;
+ if (self.fireTimer >= self.fireInterval && !self.isAttacking) {
+ self.startFireAttack();
+ }
+ };
+ self.startFireAttack = function () {
+ self.isAttacking = true;
+ self.fireTimer = 0;
+ // Flash effect when attacking
+ tween(godzillaGraphics, {
+ tint: 0xff0000
+ }, {
+ duration: 200,
+ onFinish: function onFinish() {
+ tween(godzillaGraphics, {
+ tint: 0xffffff
+ }, {
+ duration: 200,
+ onFinish: function onFinish() {
+ self.isAttacking = false;
+ // Reduce interval for increasing difficulty
+ if (self.fireInterval > 60) {
+ self.fireInterval -= 2;
+ }
+ }
+ });
+ }
+ });
+ LK.getSound('fireAttack').play();
+ // Create fire breath attack
+ createFireAttack();
+ };
+ return self;
+});
+var Jet = Container.expand(function () {
+ var self = Container.call(this);
+ var jetGraphics = self.attachAsset('jet', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 8;
+ self.isDead = false;
+ self.update = function () {
+ // Boundary checking
+ if (self.x < 60) self.x = 60;
+ if (self.x > 2048 - 60) self.x = 2048 - 60;
+ if (self.y < 60) self.y = 60;
+ if (self.y > 2732 - 60) self.y = 2732 - 60;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87ceeb
+});
+
+/****
+* Game Code
+****/
+var jet;
+var godzilla;
+var fireBreaths = [];
+var dragTarget = null;
+var survivalTime = 0;
+var lastColliding = false;
+// UI elements
+var scoreTxt = new Text2('Score: 0', {
+ size: 80,
+ fill: 0xFFFFFF
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+var timeTxt = new Text2('Time: 0s', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+timeTxt.anchor.set(1, 0);
+LK.gui.topRight.addChild(timeTxt);
+// Initialize game objects
+function initializeGame() {
+ // Create jet
+ jet = game.addChild(new Jet());
+ jet.x = 1024;
+ jet.y = 2000;
+ // Create Godzilla
+ godzilla = game.addChild(new Godzilla());
+ godzilla.x = 1024;
+ godzilla.y = 2732;
+ // Start background music
+ LK.playMusic('battleMusic');
+}
+// Create fire attack with random pattern
+function createFireAttack() {
+ var patterns = ['horizontal', 'diagonal', 'sweep'];
+ var pattern = patterns[Math.floor(Math.random() * patterns.length)];
+ var numFires = 3 + Math.floor(survivalTime / 1000); // More fires over time
+ if (numFires > 8) numFires = 8;
+ for (var i = 0; i < numFires; i++) {
+ var fire = new FireBreath();
+ fire.attackPattern = pattern;
+ if (pattern === 'horizontal') {
+ fire.x = 200 + i * 300;
+ fire.y = 2500;
+ } else if (pattern === 'diagonal') {
+ fire.x = 100 + i * 250;
+ fire.y = 2600;
+ } else if (pattern === 'sweep') {
+ fire.x = 300 + i * 200;
+ fire.y = 2400;
+ }
+ fireBreaths.push(fire);
+ game.addChild(fire);
+ // Add some visual flair
+ tween(fire, {
+ scaleX: 1.5,
+ scaleY: 1.5
+ }, {
+ duration: 300,
+ easing: tween.easeOut
+ });
+ }
+}
+// Touch controls
+game.down = function (x, y, obj) {
+ dragTarget = jet;
+ if (dragTarget) {
+ dragTarget.x = x;
+ dragTarget.y = y;
+ }
+};
+game.move = function (x, y, obj) {
+ if (dragTarget && !jet.isDead) {
+ dragTarget.x = x;
+ dragTarget.y = y;
+ }
+};
+game.up = function (x, y, obj) {
+ dragTarget = null;
+};
+// Main game update
+game.update = function () {
+ if (jet.isDead) return;
+ survivalTime += 16.67; // Approximate ms per frame at 60fps
+ // Update score and time display
+ var score = Math.floor(survivalTime / 100);
+ LK.setScore(score);
+ scoreTxt.setText('Score: ' + score);
+ timeTxt.setText('Time: ' + Math.floor(survivalTime / 1000) + 's');
+ // Check collisions with fire breath
+ var currentlyColliding = false;
+ for (var i = fireBreaths.length - 1; i >= 0; i--) {
+ var fire = fireBreaths[i];
+ if (fire.shouldDestroy) {
+ fire.destroy();
+ fireBreaths.splice(i, 1);
+ continue;
+ }
+ // Check collision with jet
+ if (jet.intersects(fire) && !currentlyColliding) {
+ currentlyColliding = true;
+ if (!lastColliding) {
+ // Collision just started
+ jet.isDead = true;
+ // Explosion effect
+ LK.effects.flashScreen(0xff4500, 1000);
+ LK.getSound('explosion').play();
+ // Jet explosion animation
+ tween(jet, {
+ scaleX: 2,
+ scaleY: 2,
+ alpha: 0
+ }, {
+ duration: 1000,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ LK.showGameOver();
+ }
+ });
+ break;
+ }
+ }
+ }
+ lastColliding = currentlyColliding;
+ // Near miss effect
+ if (!currentlyColliding && lastColliding) {
+ LK.effects.flashObject(jet, 0xffff00, 300);
+ }
+};
+// Initialize the game
+initializeGame();
\ No newline at end of file
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