Code edit (1 edits merged)
Please save this source code
User prompt
Golden Boots Adventure
Initial prompt
Toca finding golden boots (2015). The powerpuff girls have lost their golden boots. Tap blossom’s golden boots, bubbles’s golden boots, buttercup’s golden boots to find them. Choose a gift to unwrap. It will be a toy cat, or a toy frog, or a toy monkey, or a radio, or a maraca, or a drum, or a trumpet, or a party blower inside.
/**** 
* Plugins
****/ 
var tween = LK.import("@upit/tween.v1");
/**** 
* Classes
****/ 
var GiftBox = Container.expand(function () {
	var self = Container.call(this);
	var giftGraphics = self.attachAsset('giftBox', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.isOpened = false;
	self.contents = null;
	self.setContents = function (itemType) {
		self.contents = itemType;
	};
	self.open = function () {
		if (self.isOpened) return;
		self.isOpened = true;
		LK.getSound('unwrap').play();
		// Unwrap animation
		tween(giftGraphics, {
			scaleX: 0,
			scaleY: 0,
			rotation: Math.PI
		}, {
			duration: 500,
			easing: tween.easeInOut,
			onFinish: function onFinish() {
				self.showContents();
			}
		});
	};
	self.showContents = function () {
		var contentGraphics;
		switch (self.contents) {
			case 'goldenBoot':
				contentGraphics = self.attachAsset('goldenBoot', {
					anchorX: 0.5,
					anchorY: 0.5
				});
				LK.getSound('bootFound').play();
				bootsFound++;
				updateBootsDisplay();
				// Special celebration for boot
				LK.effects.flashObject(contentGraphics, 0xffd700, 1000);
				tween(contentGraphics, {
					scaleX: 1.5,
					scaleY: 1.5
				}, {
					duration: 300,
					easing: tween.bounceOut
				});
				if (bootsFound >= 3) {
					LK.setTimeout(function () {
						LK.getSound('celebrate').play();
						LK.showYouWin();
					}, 1000);
				}
				break;
			case 'toyCat':
				contentGraphics = self.attachAsset('toyCat', {
					anchorX: 0.5,
					anchorY: 0.5
				});
				break;
			case 'toyFrog':
				contentGraphics = self.attachAsset('toyFrog', {
					anchorX: 0.5,
					anchorY: 0.5
				});
				break;
			case 'toyMonkey':
				contentGraphics = self.attachAsset('toyMonkey', {
					anchorX: 0.5,
					anchorY: 0.5
				});
				break;
			case 'radio':
				contentGraphics = self.attachAsset('radio', {
					anchorX: 0.5,
					anchorY: 0.5
				});
				break;
			case 'maraca':
				contentGraphics = self.attachAsset('maraca', {
					anchorX: 0.5,
					anchorY: 0.5
				});
				break;
			case 'drum':
				contentGraphics = self.attachAsset('drum', {
					anchorX: 0.5,
					anchorY: 0.5
				});
				break;
			case 'trumpet':
				contentGraphics = self.attachAsset('trumpet', {
					anchorX: 0.5,
					anchorY: 0.5
				});
				break;
			case 'partyBlower':
				contentGraphics = self.attachAsset('partyBlower', {
					anchorX: 0.5,
					anchorY: 0.5
				});
				break;
		}
		if (contentGraphics) {
			contentGraphics.scaleX = 0;
			contentGraphics.scaleY = 0;
			tween(contentGraphics, {
				scaleX: 1,
				scaleY: 1
			}, {
				duration: 400,
				easing: tween.bounceOut
			});
		}
	};
	self.down = function (x, y, obj) {
		if (!self.isOpened) {
			self.open();
		}
	};
	return self;
});
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x87ceeb
});
/**** 
* Game Code
****/ 
var giftBoxes = [];
var bootsFound = 0;
var totalBoxes = 12;
var boxSpawnTimer = 0;
// Items that can be in gift boxes
var possibleItems = ['goldenBoot', 'goldenBoot', 'goldenBoot',
// 3 golden boots
'toyCat', 'toyFrog', 'toyMonkey', 'radio', 'maraca', 'drum', 'trumpet', 'partyBlower'];
// UI Elements
var titleText = new Text2('Golden Boots Adventure', {
	size: 80,
	fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0);
LK.gui.top.addChild(titleText);
titleText.y = 50;
var bootsText = new Text2('Boots Found: 0/3', {
	size: 60,
	fill: 0xFFD700
});
bootsText.anchor.set(0.5, 0);
LK.gui.top.addChild(bootsText);
bootsText.y = 150;
var instructionText = new Text2('Tap gifts to unwrap them!', {
	size: 50,
	fill: 0xFFFFFF
});
instructionText.anchor.set(0.5, 1);
LK.gui.bottom.addChild(instructionText);
instructionText.y = -50;
function updateBootsDisplay() {
	bootsText.setText('Boots Found: ' + bootsFound + '/3');
}
function getRandomItem() {
	var availableItems = [];
	// Always ensure we have boots available if not all found
	if (bootsFound < 3) {
		availableItems.push('goldenBoot');
	}
	// Add other items
	var otherItems = ['toyCat', 'toyFrog', 'toyMonkey', 'radio', 'maraca', 'drum', 'trumpet', 'partyBlower'];
	for (var i = 0; i < 3; i++) {
		availableItems.push(otherItems[Math.floor(Math.random() * otherItems.length)]);
	}
	return availableItems[Math.floor(Math.random() * availableItems.length)];
}
function createGiftBox() {
	var giftBox = new GiftBox();
	// Random position with margins
	var margin = 150;
	giftBox.x = margin + Math.random() * (2048 - 2 * margin);
	giftBox.y = 400 + Math.random() * (2732 - 600 - margin);
	// Set random contents
	giftBox.setContents(getRandomItem());
	// Add entrance animation
	giftBox.scaleX = 0;
	giftBox.scaleY = 0;
	giftBox.alpha = 0;
	tween(giftBox, {
		scaleX: 1,
		scaleY: 1,
		alpha: 1
	}, {
		duration: 500,
		easing: tween.bounceOut
	});
	giftBoxes.push(giftBox);
	game.addChild(giftBox);
}
// Create initial gift boxes
for (var i = 0; i < 8; i++) {
	createGiftBox();
}
game.update = function () {
	// Spawn new gift boxes periodically
	boxSpawnTimer++;
	if (boxSpawnTimer >= 180) {
		// Every 3 seconds at 60fps
		boxSpawnTimer = 0;
		if (giftBoxes.length < totalBoxes) {
			createGiftBox();
		}
	}
	// Clean up opened boxes after a while
	for (var i = giftBoxes.length - 1; i >= 0; i--) {
		var box = giftBoxes[i];
		if (box.isOpened) {
			box.openedTimer = (box.openedTimer || 0) + 1;
			if (box.openedTimer > 300) {
				// Remove after 5 seconds
				tween(box, {
					alpha: 0,
					scaleX: 0.5,
					scaleY: 0.5
				}, {
					duration: 500,
					onFinish: function onFinish() {
						box.destroy();
					}
				});
				giftBoxes.splice(i, 1);
			}
		}
	}
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,247 @@
-/****
+/**** 
+* Plugins
+****/ 
+var tween = LK.import("@upit/tween.v1");
+
+/**** 
+* Classes
+****/ 
+var GiftBox = Container.expand(function () {
+	var self = Container.call(this);
+	var giftGraphics = self.attachAsset('giftBox', {
+		anchorX: 0.5,
+		anchorY: 0.5
+	});
+	self.isOpened = false;
+	self.contents = null;
+	self.setContents = function (itemType) {
+		self.contents = itemType;
+	};
+	self.open = function () {
+		if (self.isOpened) return;
+		self.isOpened = true;
+		LK.getSound('unwrap').play();
+		// Unwrap animation
+		tween(giftGraphics, {
+			scaleX: 0,
+			scaleY: 0,
+			rotation: Math.PI
+		}, {
+			duration: 500,
+			easing: tween.easeInOut,
+			onFinish: function onFinish() {
+				self.showContents();
+			}
+		});
+	};
+	self.showContents = function () {
+		var contentGraphics;
+		switch (self.contents) {
+			case 'goldenBoot':
+				contentGraphics = self.attachAsset('goldenBoot', {
+					anchorX: 0.5,
+					anchorY: 0.5
+				});
+				LK.getSound('bootFound').play();
+				bootsFound++;
+				updateBootsDisplay();
+				// Special celebration for boot
+				LK.effects.flashObject(contentGraphics, 0xffd700, 1000);
+				tween(contentGraphics, {
+					scaleX: 1.5,
+					scaleY: 1.5
+				}, {
+					duration: 300,
+					easing: tween.bounceOut
+				});
+				if (bootsFound >= 3) {
+					LK.setTimeout(function () {
+						LK.getSound('celebrate').play();
+						LK.showYouWin();
+					}, 1000);
+				}
+				break;
+			case 'toyCat':
+				contentGraphics = self.attachAsset('toyCat', {
+					anchorX: 0.5,
+					anchorY: 0.5
+				});
+				break;
+			case 'toyFrog':
+				contentGraphics = self.attachAsset('toyFrog', {
+					anchorX: 0.5,
+					anchorY: 0.5
+				});
+				break;
+			case 'toyMonkey':
+				contentGraphics = self.attachAsset('toyMonkey', {
+					anchorX: 0.5,
+					anchorY: 0.5
+				});
+				break;
+			case 'radio':
+				contentGraphics = self.attachAsset('radio', {
+					anchorX: 0.5,
+					anchorY: 0.5
+				});
+				break;
+			case 'maraca':
+				contentGraphics = self.attachAsset('maraca', {
+					anchorX: 0.5,
+					anchorY: 0.5
+				});
+				break;
+			case 'drum':
+				contentGraphics = self.attachAsset('drum', {
+					anchorX: 0.5,
+					anchorY: 0.5
+				});
+				break;
+			case 'trumpet':
+				contentGraphics = self.attachAsset('trumpet', {
+					anchorX: 0.5,
+					anchorY: 0.5
+				});
+				break;
+			case 'partyBlower':
+				contentGraphics = self.attachAsset('partyBlower', {
+					anchorX: 0.5,
+					anchorY: 0.5
+				});
+				break;
+		}
+		if (contentGraphics) {
+			contentGraphics.scaleX = 0;
+			contentGraphics.scaleY = 0;
+			tween(contentGraphics, {
+				scaleX: 1,
+				scaleY: 1
+			}, {
+				duration: 400,
+				easing: tween.bounceOut
+			});
+		}
+	};
+	self.down = function (x, y, obj) {
+		if (!self.isOpened) {
+			self.open();
+		}
+	};
+	return self;
+});
+
+/**** 
 * Initialize Game
-****/
+****/ 
 var game = new LK.Game({
-	backgroundColor: 0x000000
-});
\ No newline at end of file
+	backgroundColor: 0x87ceeb
+});
+
+/**** 
+* Game Code
+****/ 
+var giftBoxes = [];
+var bootsFound = 0;
+var totalBoxes = 12;
+var boxSpawnTimer = 0;
+// Items that can be in gift boxes
+var possibleItems = ['goldenBoot', 'goldenBoot', 'goldenBoot',
+// 3 golden boots
+'toyCat', 'toyFrog', 'toyMonkey', 'radio', 'maraca', 'drum', 'trumpet', 'partyBlower'];
+// UI Elements
+var titleText = new Text2('Golden Boots Adventure', {
+	size: 80,
+	fill: 0xFFFFFF
+});
+titleText.anchor.set(0.5, 0);
+LK.gui.top.addChild(titleText);
+titleText.y = 50;
+var bootsText = new Text2('Boots Found: 0/3', {
+	size: 60,
+	fill: 0xFFD700
+});
+bootsText.anchor.set(0.5, 0);
+LK.gui.top.addChild(bootsText);
+bootsText.y = 150;
+var instructionText = new Text2('Tap gifts to unwrap them!', {
+	size: 50,
+	fill: 0xFFFFFF
+});
+instructionText.anchor.set(0.5, 1);
+LK.gui.bottom.addChild(instructionText);
+instructionText.y = -50;
+function updateBootsDisplay() {
+	bootsText.setText('Boots Found: ' + bootsFound + '/3');
+}
+function getRandomItem() {
+	var availableItems = [];
+	// Always ensure we have boots available if not all found
+	if (bootsFound < 3) {
+		availableItems.push('goldenBoot');
+	}
+	// Add other items
+	var otherItems = ['toyCat', 'toyFrog', 'toyMonkey', 'radio', 'maraca', 'drum', 'trumpet', 'partyBlower'];
+	for (var i = 0; i < 3; i++) {
+		availableItems.push(otherItems[Math.floor(Math.random() * otherItems.length)]);
+	}
+	return availableItems[Math.floor(Math.random() * availableItems.length)];
+}
+function createGiftBox() {
+	var giftBox = new GiftBox();
+	// Random position with margins
+	var margin = 150;
+	giftBox.x = margin + Math.random() * (2048 - 2 * margin);
+	giftBox.y = 400 + Math.random() * (2732 - 600 - margin);
+	// Set random contents
+	giftBox.setContents(getRandomItem());
+	// Add entrance animation
+	giftBox.scaleX = 0;
+	giftBox.scaleY = 0;
+	giftBox.alpha = 0;
+	tween(giftBox, {
+		scaleX: 1,
+		scaleY: 1,
+		alpha: 1
+	}, {
+		duration: 500,
+		easing: tween.bounceOut
+	});
+	giftBoxes.push(giftBox);
+	game.addChild(giftBox);
+}
+// Create initial gift boxes
+for (var i = 0; i < 8; i++) {
+	createGiftBox();
+}
+game.update = function () {
+	// Spawn new gift boxes periodically
+	boxSpawnTimer++;
+	if (boxSpawnTimer >= 180) {
+		// Every 3 seconds at 60fps
+		boxSpawnTimer = 0;
+		if (giftBoxes.length < totalBoxes) {
+			createGiftBox();
+		}
+	}
+	// Clean up opened boxes after a while
+	for (var i = giftBoxes.length - 1; i >= 0; i--) {
+		var box = giftBoxes[i];
+		if (box.isOpened) {
+			box.openedTimer = (box.openedTimer || 0) + 1;
+			if (box.openedTimer > 300) {
+				// Remove after 5 seconds
+				tween(box, {
+					alpha: 0,
+					scaleX: 0.5,
+					scaleY: 0.5
+				}, {
+					duration: 500,
+					onFinish: function onFinish() {
+						box.destroy();
+					}
+				});
+				giftBoxes.splice(i, 1);
+			}
+		}
+	}
+};
\ No newline at end of file