Code edit (1 edits merged)
Please save this source code
User prompt
Phoenix Nest: The Great Hatching Chaos
Initial prompt
Okay, here's a comic strip based on your prompt. It's a slightly absurd setup, but hopefully fun! Panel 1 Setting: A ridiculously large nest made of twigs, leaves, and whatever else birds use. Inside, ten speckled eggs are nestled. Vixen, a majestic Phoenix (with glowing embers flickering around her), sits panting heavily. Jason, a sleek, black Crow, stands beside her, nervously preening his feathers. Visual: Vixen is visibly pregnant, her belly round beneath her fiery plumage. Caption: "Vixen and Jason: A Love Story for the Ages... and the Stork." Jason (Speech Balloon): "Are you sure you're alright, dear? Ten hatchlings AND... gestures to her belly with a wing... all at once?" Vixen (Speech Balloon, strained): "Just... a little tired, darling. But the eggs... they're moving!" Panel 2 Setting: Close-up of the eggs. One is starting to crack. You can see a tiny beak chipping away. Visual: Exaggerated cracks appearing on the first egg. SFX: CRACK! Caption: "The Hatching Begins!" Panel 3 Setting: Pull back to show the nest again. The cracked egg has a tiny Falcon peeking out. Visual: A small, fluffy falcon chick (Richard) emerges from the egg. Richard (Speech Balloon): "Cheep?" Jason (Speech Balloon, pointing excitedly): "It's Richard! The first! Welcome to the world!" Vixen (Speech Balloon, exhausted but happy): "He's... beautiful." Panel 4 Setting: A chaotic scene. Several more eggs are cracking. Little birds are popping out: an Eagle (Geoffrey), a Chough (Quinn), a Robin (Nina), a Stork (Astrid), a Duck (Martin), a Macaw (Ronald), a Seagull(Graham), a Hummingbird (Jones), and a Swan (Swen). Visual: Lots of tiny birds everywhere. Jason is desperately trying to keep them from falling out of the nest. Vixen is still panting, but a faint smile is on her face. SFX: CHEEP! SQUAWK! PEEP! Caption: "And then all at once. Panel 5 Setting: Close-up of Vixen's belly. It gives a significant kick. SFX: THUMP! Caption: "Oh boy... Vixen (Speech Balloon): "Oh, COME ON!" With 2D Video
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Chick class var Chick = Container.expand(function () { var self = Container.call(this); self.chickId = null; self.chickAsset = null; self.eggRef = null; self.isDragged = false; self.vx = 0; self.vy = 0; self.gravity = 0.7 + Math.random() * 0.3; self.bounce = 0.5 + Math.random() * 0.2; self.lastIntersecting = true; self.setChick = function (chickId) { self.chickId = chickId; self.chickAsset = self.attachAsset(chickId, { anchorX: 0.5, anchorY: 0.5 }); }; // Drag events self.down = function (x, y, obj) { self.isDragged = true; self.vx = 0; self.vy = 0; }; self.up = function (x, y, obj) { self.isDragged = false; }; return self; }); // Egg class var Egg = Container.expand(function () { var self = Container.call(this); self.eggId = null; self.chickId = null; self.hatched = false; self.chick = null; self.hatchTimer = 0; self.hatchDelay = 0; self.setEgg = function (eggId, chickId, hatchDelay) { self.eggId = eggId; self.chickId = chickId; self.hatchDelay = hatchDelay; self.eggAsset = self.attachAsset(eggId, { anchorX: 0.5, anchorY: 0.5 }); }; self.hatch = function () { if (self.hatched) return; self.hatched = true; if (self.eggAsset) { tween(self.eggAsset, { alpha: 0 }, { duration: 300, onFinish: function onFinish() { self.eggAsset.visible = false; } }); } LK.getSound('hatch').play(); self.chick = new Chick(); self.chick.setChick(self.chickId); self.chick.x = self.x; self.chick.y = self.y; self.parent.addChild(self.chick); self.chick.eggRef = self; }; return self; }); // Jason (Crow) class var Jason = Container.expand(function () { var self = Container.call(this); var jasonAsset = self.attachAsset('jason', { anchorX: 0.5, anchorY: 1 }); return self; }); // Nest class (static, for collision) var Nest = Container.expand(function () { var self = Container.call(this); var nestAsset = self.attachAsset('nest', { anchorX: 0.5, anchorY: 0.5 }); return self; }); // Vixen (Phoenix) class var Vixen = Container.expand(function () { var self = Container.call(this); var vixenAsset = self.attachAsset('vixen', { anchorX: 0.5, anchorY: 1 }); // Vixen's "belly" for surprise self.bellyGlow = self.attachAsset('surpriseEgg', { anchorX: 0.5, anchorY: 0.7, scaleX: 0.5, scaleY: 0.5, y: 60 }); self.bellyGlow.alpha = 0.0; self.showGlow = function () { tween(self.bellyGlow, { alpha: 0.7, scaleX: 1, scaleY: 1 }, { duration: 800, easing: tween.easeInOut }); }; self.hideGlow = function () { tween(self.bellyGlow, { alpha: 0.0, scaleX: 0.5, scaleY: 0.5 }, { duration: 800, easing: tween.easeInOut }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xF5E9D3 }); /**** * Game Code ****/ // We'll use colored ellipses/boxes for eggs/chicks, and simple shapes for Vixen, Jason, and the nest. // Ten unique bird eggs and chicks, Vixen (phoenix), Jason (crow), nest, and a "surprise" egg. // Center nest horizontally, place near bottom var nest = new Nest(); nest.x = 2048 / 2; nest.y = 2732 - 400; game.addChild(nest); // Place Vixen and Jason on the nest rim var vixen = new Vixen(); vixen.x = nest.x - 350; vixen.y = nest.y - 180; game.addChild(vixen); var jason = new Jason(); jason.x = nest.x + 350; jason.y = nest.y - 180; game.addChild(jason); // Egg and chick management var eggPositions = [{ x: nest.x - 350, y: nest.y - 60 }, { x: nest.x - 220, y: nest.y - 100 }, { x: nest.x - 80, y: nest.y - 40 }, { x: nest.x + 80, y: nest.y - 60 }, { x: nest.x + 220, y: nest.y - 100 }, { x: nest.x + 350, y: nest.y - 60 }, { x: nest.x - 160, y: nest.y + 40 }, { x: nest.x, y: nest.y + 60 }, { x: nest.x + 160, y: nest.y + 40 }, { x: nest.x, y: nest.y - 120 }]; var eggIds = ['egg1', 'egg2', 'egg3', 'egg4', 'egg5', 'egg6', 'egg7', 'egg8', 'egg9', 'egg10']; var chickIds = ['chick1', 'chick2', 'chick3', 'chick4', 'chick5', 'chick6', 'chick7', 'chick8', 'chick9', 'chick10']; // Shuffle hatch delays for chaos var hatchDelays = []; for (var i = 0; i < 10; i++) { hatchDelays.push(800 + Math.floor(Math.random() * 1200) + i * 300); } // Create eggs var eggs = []; for (var i = 0; i < 10; i++) { var egg = new Egg(); egg.setEgg(eggIds[i], chickIds[i], hatchDelays[i]); egg.x = eggPositions[i].x; egg.y = eggPositions[i].y; eggs.push(egg); game.addChild(egg); } // Track all chicks var chicks = []; // Score = number of chicks still in nest var scoreTxt = new Text2('10', { size: 120, fill: "#222" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Timer for hatching var hatchTick = 0; var allHatched = false; var surpriseShown = false; var surpriseEgg = null; var surpriseEggTimer = 0; var gameOver = false; // Dragging var dragChick = null; // Helper: is chick in nest? function chickInNest(chick) { // Use ellipse collision: (x-h)^2/a^2 + (y-k)^2/b^2 <= 1 var dx = chick.x - nest.x; var dy = chick.y - nest.y + 40; // fudge for nest rim var a = nest.width * 0.48; var b = nest.height * 0.38; return dx * dx / (a * a) + dy * dy / (b * b) <= 1; } // Helper: update score function updateScore() { var count = 0; for (var i = 0; i < chicks.length; i++) { if (chickInNest(chicks[i])) count++; } scoreTxt.setText(count); if (count === 0 && !gameOver) { gameOver = true; LK.effects.flashScreen(0x990000, 1000); LK.showGameOver(); } } // Game move handler (drag chicks) function handleMove(x, y, obj) { if (dragChick && !gameOver) { dragChick.x = x; dragChick.y = y; dragChick.vx = 0; dragChick.vy = 0; } } game.move = handleMove; // Down: start drag if on chick game.down = function (x, y, obj) { if (gameOver) return; // Find topmost chick under pointer for (var i = chicks.length - 1; i >= 0; i--) { var chick = chicks[i]; var dx = x - chick.x; var dy = y - chick.y; var r = chick.chickAsset.width * 0.5; if (dx * dx + dy * dy < r * r) { dragChick = chick; chick.isDragged = true; break; } } handleMove(x, y, obj); }; // Up: stop drag game.up = function (x, y, obj) { if (dragChick) { dragChick.isDragged = false; dragChick = null; } }; // Main game update game.update = function () { if (gameOver) return; // Hatching logic hatchTick += 16; for (var i = 0; i < eggs.length; i++) { var egg = eggs[i]; if (!egg.hatched && hatchTick > egg.hatchDelay) { egg.hatch(); if (egg.chick) { chicks.push(egg.chick); LK.getSound('chirp').play(); } } } // All hatched? if (!allHatched) { var all = true; for (var i = 0; i < eggs.length; i++) { if (!eggs[i].hatched) all = false; } if (all) { allHatched = true; vixen.showGlow(); surpriseEggTimer = 0; } } // Chicks physics for (var i = 0; i < chicks.length; i++) { var chick = chicks[i]; if (chick.isDragged) continue; // Simple random walk for chaos if (LK.ticks % (30 + i * 3) === 0) { chick.vx += (Math.random() - 0.5) * 2.5; chick.vy += (Math.random() - 0.5) * 2.5; } // Gravity chick.vy += chick.gravity; // Move chick.x += chick.vx; chick.y += chick.vy; // Friction chick.vx *= 0.97; chick.vy *= 0.97; // Bounce off nest edge if (chickInNest(chick)) { // If moving out, bounce back var dx = chick.x - nest.x; var dy = chick.y - nest.y + 40; var a = nest.width * 0.48; var b = nest.height * 0.38; var dist = Math.sqrt(dx * dx / (a * a) + dy * dy / (b * b)); if (dist > 0.95) { // Bounce inward var angle = Math.atan2(dy, dx); chick.vx -= Math.cos(angle) * 2 * chick.bounce; chick.vy -= Math.sin(angle) * 2 * chick.bounce; } } else { // Out of nest! if (chick.lastIntersecting) { LK.getSound('tumble').play(); LK.effects.flashObject(chick, 0x000000, 400); } // Let chick fall off screen if (chick.y > 2732 + 100) { // Remove chick chick.destroy(); chicks.splice(i, 1); i--; updateScore(); continue; } } chick.lastIntersecting = chickInNest(chick); } updateScore(); // Surprise egg event if (allHatched && !surpriseShown) { surpriseEggTimer += 16; if (surpriseEggTimer > 1800) { // Show surprise egg surpriseEgg = LK.getAsset('surpriseEgg', { anchorX: 0.5, anchorY: 1, scaleX: 0.1, scaleY: 0.1, x: vixen.x, y: vixen.y - 120 }); game.addChild(surpriseEgg); LK.getSound('surprise').play(); tween(surpriseEgg, { scaleX: 1, scaleY: 1, y: vixen.y + 40 }, { duration: 900, easing: tween.elasticInOut }); vixen.hideGlow(); surpriseShown = true; } } // Win condition: all chicks survived and surprise egg appeared if (surpriseShown && chicks.length > 0 && !gameOver) { // Wait a bit, then win if (surpriseEggTimer > 3200) { LK.effects.flashScreen(0xFFD700, 1200); LK.showYouWin(); gameOver = true; } } }; // Playful background music (not included per instructions)
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,400 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+// Chick class
+var Chick = Container.expand(function () {
+ var self = Container.call(this);
+ self.chickId = null;
+ self.chickAsset = null;
+ self.eggRef = null;
+ self.isDragged = false;
+ self.vx = 0;
+ self.vy = 0;
+ self.gravity = 0.7 + Math.random() * 0.3;
+ self.bounce = 0.5 + Math.random() * 0.2;
+ self.lastIntersecting = true;
+ self.setChick = function (chickId) {
+ self.chickId = chickId;
+ self.chickAsset = self.attachAsset(chickId, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ };
+ // Drag events
+ self.down = function (x, y, obj) {
+ self.isDragged = true;
+ self.vx = 0;
+ self.vy = 0;
+ };
+ self.up = function (x, y, obj) {
+ self.isDragged = false;
+ };
+ return self;
+});
+// Egg class
+var Egg = Container.expand(function () {
+ var self = Container.call(this);
+ self.eggId = null;
+ self.chickId = null;
+ self.hatched = false;
+ self.chick = null;
+ self.hatchTimer = 0;
+ self.hatchDelay = 0;
+ self.setEgg = function (eggId, chickId, hatchDelay) {
+ self.eggId = eggId;
+ self.chickId = chickId;
+ self.hatchDelay = hatchDelay;
+ self.eggAsset = self.attachAsset(eggId, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ };
+ self.hatch = function () {
+ if (self.hatched) return;
+ self.hatched = true;
+ if (self.eggAsset) {
+ tween(self.eggAsset, {
+ alpha: 0
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ self.eggAsset.visible = false;
+ }
+ });
+ }
+ LK.getSound('hatch').play();
+ self.chick = new Chick();
+ self.chick.setChick(self.chickId);
+ self.chick.x = self.x;
+ self.chick.y = self.y;
+ self.parent.addChild(self.chick);
+ self.chick.eggRef = self;
+ };
+ return self;
+});
+// Jason (Crow) class
+var Jason = Container.expand(function () {
+ var self = Container.call(this);
+ var jasonAsset = self.attachAsset('jason', {
+ anchorX: 0.5,
+ anchorY: 1
+ });
+ return self;
+});
+// Nest class (static, for collision)
+var Nest = Container.expand(function () {
+ var self = Container.call(this);
+ var nestAsset = self.attachAsset('nest', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ return self;
+});
+// Vixen (Phoenix) class
+var Vixen = Container.expand(function () {
+ var self = Container.call(this);
+ var vixenAsset = self.attachAsset('vixen', {
+ anchorX: 0.5,
+ anchorY: 1
+ });
+ // Vixen's "belly" for surprise
+ self.bellyGlow = self.attachAsset('surpriseEgg', {
+ anchorX: 0.5,
+ anchorY: 0.7,
+ scaleX: 0.5,
+ scaleY: 0.5,
+ y: 60
+ });
+ self.bellyGlow.alpha = 0.0;
+ self.showGlow = function () {
+ tween(self.bellyGlow, {
+ alpha: 0.7,
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 800,
+ easing: tween.easeInOut
+ });
+ };
+ self.hideGlow = function () {
+ tween(self.bellyGlow, {
+ alpha: 0.0,
+ scaleX: 0.5,
+ scaleY: 0.5
+ }, {
+ duration: 800,
+ easing: tween.easeInOut
+ });
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0xF5E9D3
+});
+
+/****
+* Game Code
+****/
+// We'll use colored ellipses/boxes for eggs/chicks, and simple shapes for Vixen, Jason, and the nest.
+// Ten unique bird eggs and chicks, Vixen (phoenix), Jason (crow), nest, and a "surprise" egg.
+// Center nest horizontally, place near bottom
+var nest = new Nest();
+nest.x = 2048 / 2;
+nest.y = 2732 - 400;
+game.addChild(nest);
+// Place Vixen and Jason on the nest rim
+var vixen = new Vixen();
+vixen.x = nest.x - 350;
+vixen.y = nest.y - 180;
+game.addChild(vixen);
+var jason = new Jason();
+jason.x = nest.x + 350;
+jason.y = nest.y - 180;
+game.addChild(jason);
+// Egg and chick management
+var eggPositions = [{
+ x: nest.x - 350,
+ y: nest.y - 60
+}, {
+ x: nest.x - 220,
+ y: nest.y - 100
+}, {
+ x: nest.x - 80,
+ y: nest.y - 40
+}, {
+ x: nest.x + 80,
+ y: nest.y - 60
+}, {
+ x: nest.x + 220,
+ y: nest.y - 100
+}, {
+ x: nest.x + 350,
+ y: nest.y - 60
+}, {
+ x: nest.x - 160,
+ y: nest.y + 40
+}, {
+ x: nest.x,
+ y: nest.y + 60
+}, {
+ x: nest.x + 160,
+ y: nest.y + 40
+}, {
+ x: nest.x,
+ y: nest.y - 120
+}];
+var eggIds = ['egg1', 'egg2', 'egg3', 'egg4', 'egg5', 'egg6', 'egg7', 'egg8', 'egg9', 'egg10'];
+var chickIds = ['chick1', 'chick2', 'chick3', 'chick4', 'chick5', 'chick6', 'chick7', 'chick8', 'chick9', 'chick10'];
+// Shuffle hatch delays for chaos
+var hatchDelays = [];
+for (var i = 0; i < 10; i++) {
+ hatchDelays.push(800 + Math.floor(Math.random() * 1200) + i * 300);
+}
+// Create eggs
+var eggs = [];
+for (var i = 0; i < 10; i++) {
+ var egg = new Egg();
+ egg.setEgg(eggIds[i], chickIds[i], hatchDelays[i]);
+ egg.x = eggPositions[i].x;
+ egg.y = eggPositions[i].y;
+ eggs.push(egg);
+ game.addChild(egg);
+}
+// Track all chicks
+var chicks = [];
+// Score = number of chicks still in nest
+var scoreTxt = new Text2('10', {
+ size: 120,
+ fill: "#222"
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+// Timer for hatching
+var hatchTick = 0;
+var allHatched = false;
+var surpriseShown = false;
+var surpriseEgg = null;
+var surpriseEggTimer = 0;
+var gameOver = false;
+// Dragging
+var dragChick = null;
+// Helper: is chick in nest?
+function chickInNest(chick) {
+ // Use ellipse collision: (x-h)^2/a^2 + (y-k)^2/b^2 <= 1
+ var dx = chick.x - nest.x;
+ var dy = chick.y - nest.y + 40; // fudge for nest rim
+ var a = nest.width * 0.48;
+ var b = nest.height * 0.38;
+ return dx * dx / (a * a) + dy * dy / (b * b) <= 1;
+}
+// Helper: update score
+function updateScore() {
+ var count = 0;
+ for (var i = 0; i < chicks.length; i++) {
+ if (chickInNest(chicks[i])) count++;
+ }
+ scoreTxt.setText(count);
+ if (count === 0 && !gameOver) {
+ gameOver = true;
+ LK.effects.flashScreen(0x990000, 1000);
+ LK.showGameOver();
+ }
+}
+// Game move handler (drag chicks)
+function handleMove(x, y, obj) {
+ if (dragChick && !gameOver) {
+ dragChick.x = x;
+ dragChick.y = y;
+ dragChick.vx = 0;
+ dragChick.vy = 0;
+ }
+}
+game.move = handleMove;
+// Down: start drag if on chick
+game.down = function (x, y, obj) {
+ if (gameOver) return;
+ // Find topmost chick under pointer
+ for (var i = chicks.length - 1; i >= 0; i--) {
+ var chick = chicks[i];
+ var dx = x - chick.x;
+ var dy = y - chick.y;
+ var r = chick.chickAsset.width * 0.5;
+ if (dx * dx + dy * dy < r * r) {
+ dragChick = chick;
+ chick.isDragged = true;
+ break;
+ }
+ }
+ handleMove(x, y, obj);
+};
+// Up: stop drag
+game.up = function (x, y, obj) {
+ if (dragChick) {
+ dragChick.isDragged = false;
+ dragChick = null;
+ }
+};
+// Main game update
+game.update = function () {
+ if (gameOver) return;
+ // Hatching logic
+ hatchTick += 16;
+ for (var i = 0; i < eggs.length; i++) {
+ var egg = eggs[i];
+ if (!egg.hatched && hatchTick > egg.hatchDelay) {
+ egg.hatch();
+ if (egg.chick) {
+ chicks.push(egg.chick);
+ LK.getSound('chirp').play();
+ }
+ }
+ }
+ // All hatched?
+ if (!allHatched) {
+ var all = true;
+ for (var i = 0; i < eggs.length; i++) {
+ if (!eggs[i].hatched) all = false;
+ }
+ if (all) {
+ allHatched = true;
+ vixen.showGlow();
+ surpriseEggTimer = 0;
+ }
+ }
+ // Chicks physics
+ for (var i = 0; i < chicks.length; i++) {
+ var chick = chicks[i];
+ if (chick.isDragged) continue;
+ // Simple random walk for chaos
+ if (LK.ticks % (30 + i * 3) === 0) {
+ chick.vx += (Math.random() - 0.5) * 2.5;
+ chick.vy += (Math.random() - 0.5) * 2.5;
+ }
+ // Gravity
+ chick.vy += chick.gravity;
+ // Move
+ chick.x += chick.vx;
+ chick.y += chick.vy;
+ // Friction
+ chick.vx *= 0.97;
+ chick.vy *= 0.97;
+ // Bounce off nest edge
+ if (chickInNest(chick)) {
+ // If moving out, bounce back
+ var dx = chick.x - nest.x;
+ var dy = chick.y - nest.y + 40;
+ var a = nest.width * 0.48;
+ var b = nest.height * 0.38;
+ var dist = Math.sqrt(dx * dx / (a * a) + dy * dy / (b * b));
+ if (dist > 0.95) {
+ // Bounce inward
+ var angle = Math.atan2(dy, dx);
+ chick.vx -= Math.cos(angle) * 2 * chick.bounce;
+ chick.vy -= Math.sin(angle) * 2 * chick.bounce;
+ }
+ } else {
+ // Out of nest!
+ if (chick.lastIntersecting) {
+ LK.getSound('tumble').play();
+ LK.effects.flashObject(chick, 0x000000, 400);
+ }
+ // Let chick fall off screen
+ if (chick.y > 2732 + 100) {
+ // Remove chick
+ chick.destroy();
+ chicks.splice(i, 1);
+ i--;
+ updateScore();
+ continue;
+ }
+ }
+ chick.lastIntersecting = chickInNest(chick);
+ }
+ updateScore();
+ // Surprise egg event
+ if (allHatched && !surpriseShown) {
+ surpriseEggTimer += 16;
+ if (surpriseEggTimer > 1800) {
+ // Show surprise egg
+ surpriseEgg = LK.getAsset('surpriseEgg', {
+ anchorX: 0.5,
+ anchorY: 1,
+ scaleX: 0.1,
+ scaleY: 0.1,
+ x: vixen.x,
+ y: vixen.y - 120
+ });
+ game.addChild(surpriseEgg);
+ LK.getSound('surprise').play();
+ tween(surpriseEgg, {
+ scaleX: 1,
+ scaleY: 1,
+ y: vixen.y + 40
+ }, {
+ duration: 900,
+ easing: tween.elasticInOut
+ });
+ vixen.hideGlow();
+ surpriseShown = true;
+ }
+ }
+ // Win condition: all chicks survived and surprise egg appeared
+ if (surpriseShown && chicks.length > 0 && !gameOver) {
+ // Wait a bit, then win
+ if (surpriseEggTimer > 3200) {
+ LK.effects.flashScreen(0xFFD700, 1200);
+ LK.showYouWin();
+ gameOver = true;
+ }
+ }
+};
+// Playful background music (not included per instructions)
\ No newline at end of file