Code edit (1 edits merged)
Please save this source code
User prompt
Dress Up Duo
Initial prompt
Toca dress up (2011). Ginger 🐱 and Harvey 🐶 are inside granny and grandpa’s home. Choose ginger 🐱 or Harvey 🐶 to dress up with, drag on the clothes you want it to wear, tap on the jukebox to play a song, tap on the camera to take a picture
/**** 
* Plugins
****/ 
var tween = LK.import("@upit/tween.v1");
/**** 
* Classes
****/ 
var Camera = Container.expand(function () {
	var self = Container.call(this);
	var cameraGraphics = self.attachAsset('camera', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	var lensText = new Text2('📷', {
		size: 40,
		fill: 0xFFFFFF
	});
	lensText.anchor.set(0.5, 0.5);
	self.addChild(lensText);
	self.down = function (x, y, obj) {
		LK.getSound('cameraClick').play();
		LK.effects.flashScreen(0xFFFFFF, 300);
		tween(self, {
			scaleX: 0.8,
			scaleY: 0.8
		}, {
			duration: 150,
			onFinish: function onFinish() {
				tween(self, {
					scaleX: 1,
					scaleY: 1
				}, {
					duration: 150
				});
			}
		});
	};
	return self;
});
var Character = Container.expand(function (name, hairColor) {
	var self = Container.call(this);
	self.name = name;
	self.wornItems = [];
	var body = self.attachAsset('characterBase', {
		anchorX: 0.5,
		anchorY: 1
	});
	var hair = self.attachAsset(name === 'Ginger' ? 'gingerHair' : 'harveyHair', {
		anchorX: 0.5,
		anchorY: 0.5,
		y: -480
	});
	self.addClothing = function (item) {
		if (item.type === 'shirt') {
			item.x = 0;
			item.y = -300;
		} else if (item.type === 'pants') {
			item.x = 0;
			item.y = -150;
		} else if (item.type === 'dress') {
			item.x = 0;
			item.y = -200;
		} else if (item.type === 'hat') {
			item.x = 0;
			item.y = -520;
		} else if (item.type === 'shoes') {
			item.x = 0;
			item.y = 0;
		}
		self.addChild(item);
		item.isWorn = true;
		self.wornItems.push(item);
		LK.getSound('dressSound').play();
	};
	self.removeClothing = function (item) {
		if (item.isWorn) {
			var index = self.wornItems.indexOf(item);
			if (index > -1) {
				self.wornItems.splice(index, 1);
			}
			item.isWorn = false;
			self.removeChild(item);
			closet.addChild(item);
			item.x = Math.random() * 200 - 100;
			item.y = Math.random() * 300 - 150;
		}
	};
	return self;
});
var ClothingItem = Container.expand(function (type, color, size) {
	var self = Container.call(this);
	self.type = type;
	self.originalParent = null;
	self.isWorn = false;
	var itemGraphics = self.attachAsset('clothingItem', {
		anchorX: 0.5,
		anchorY: 0.5,
		scaleX: size || 1,
		scaleY: size || 1
	});
	if (color) {
		itemGraphics.tint = color;
	}
	self.down = function (x, y, obj) {
		if (!self.isWorn) {
			draggedItem = self;
			dragOffset.x = x;
			dragOffset.y = y;
			LK.getSound('clickSound').play();
		}
	};
	return self;
});
var Jukebox = Container.expand(function () {
	var self = Container.call(this);
	self.currentTrack = 0;
	self.tracks = ['jukebox1', 'jukebox2', 'jukebox3'];
	var jukeboxGraphics = self.attachAsset('jukebox', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	var playText = new Text2('♪', {
		size: 60,
		fill: 0xFFD700
	});
	playText.anchor.set(0.5, 0.5);
	self.addChild(playText);
	self.down = function (x, y, obj) {
		self.currentTrack = (self.currentTrack + 1) % self.tracks.length;
		LK.playMusic(self.tracks[self.currentTrack]);
		LK.getSound('clickSound').play();
		tween(playText, {
			scaleX: 1.3,
			scaleY: 1.3
		}, {
			duration: 200,
			onFinish: function onFinish() {
				tween(playText, {
					scaleX: 1,
					scaleY: 1
				}, {
					duration: 200
				});
			}
		});
	};
	return self;
});
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0xF5E6D3
});
/**** 
* Game Code
****/ 
var gameState = 'characterSelect';
var selectedCharacter = null;
var ginger = null;
var harvey = null;
var closet = null;
var draggedItem = null;
var dragOffset = {
	x: 0,
	y: 0
};
var jukebox = null;
var camera = null;
var clothingItems = [];
// Character selection buttons
var gingerButton = game.addChild(LK.getAsset('selectButton', {
	anchorX: 0.5,
	anchorY: 0.5,
	x: 2048 / 4,
	y: 2732 / 2,
	tint: 0xFF69B4
}));
var gingerText = new Text2('Ginger', {
	size: 40,
	fill: 0xFFFFFF
});
gingerText.anchor.set(0.5, 0.5);
gingerButton.addChild(gingerText);
var harveyButton = game.addChild(LK.getAsset('selectButton', {
	anchorX: 0.5,
	anchorY: 0.5,
	x: 3 * 2048 / 4,
	y: 2732 / 2,
	tint: 0x4169E1
}));
var harveyText = new Text2('Harvey', {
	size: 40,
	fill: 0xFFFFFF
});
harveyText.anchor.set(0.5, 0.5);
harveyButton.addChild(harveyText);
var titleText = new Text2('Choose Your Character', {
	size: 80,
	fill: 0x8B4513
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 2732 / 3;
game.addChild(titleText);
function initializeGame() {
	// Remove selection UI
	game.removeChild(gingerButton);
	game.removeChild(harveyButton);
	game.removeChild(titleText);
	// Create characters
	ginger = new Character('Ginger', 0xD2691E);
	harvey = new Character('Harvey', 0x8B4513);
	// Position selected character
	if (selectedCharacter === 'Ginger') {
		ginger.x = 2048 / 2;
		ginger.y = 2732 - 200;
		game.addChild(ginger);
	} else {
		harvey.x = 2048 / 2;
		harvey.y = 2732 - 200;
		game.addChild(harvey);
	}
	// Create closet
	closet = game.addChild(LK.getAsset('closet', {
		anchorX: 0.5,
		anchorY: 0.5,
		x: 150,
		y: 2732 / 2
	}));
	// Create clothing items
	var clothing = [{
		type: 'shirt',
		color: 0x4169E1,
		count: 3
	}, {
		type: 'pants',
		color: 0x2F4F4F,
		count: 2
	}, {
		type: 'dress',
		color: 0xFF69B4,
		count: 2
	}, {
		type: 'hat',
		color: 0x8B0000,
		count: 2
	}, {
		type: 'shoes',
		color: 0x654321,
		count: 2
	}];
	clothing.forEach(function (clothingType, typeIndex) {
		for (var i = 0; i < clothingType.count; i++) {
			var item = new ClothingItem(clothingType.type, clothingType.color, 0.8);
			item.x = i * 80 - 100;
			item.y = typeIndex * 80 - 200;
			closet.addChild(item);
			clothingItems.push(item);
		}
	});
	// Create jukebox
	jukebox = game.addChild(new Jukebox());
	jukebox.x = 2048 - 150;
	jukebox.y = 300;
	// Create camera
	camera = game.addChild(new Camera());
	camera.x = 2048 - 150;
	camera.y = 2732 - 300;
	gameState = 'dressup';
}
game.down = function (x, y, obj) {
	if (gameState === 'characterSelect') {
		var localPos = gingerButton.toLocal({
			x: x,
			y: y
		});
		if (localPos.x >= -100 && localPos.x <= 100 && localPos.y >= -40 && localPos.y <= 40) {
			selectedCharacter = 'Ginger';
			LK.getSound('clickSound').play();
			initializeGame();
			return;
		}
		localPos = harveyButton.toLocal({
			x: x,
			y: y
		});
		if (localPos.x >= -100 && localPos.x <= 100 && localPos.y >= -40 && localPos.y <= 40) {
			selectedCharacter = 'Harvey';
			LK.getSound('clickSound').play();
			initializeGame();
			return;
		}
	}
};
game.move = function (x, y, obj) {
	if (draggedItem && gameState === 'dressup') {
		draggedItem.x = x - dragOffset.x;
		draggedItem.y = y - dragOffset.y;
	}
};
game.up = function (x, y, obj) {
	if (draggedItem && gameState === 'dressup') {
		var currentChar = selectedCharacter === 'Ginger' ? ginger : harvey;
		var charBounds = currentChar.getBounds();
		if (x >= charBounds.x && x <= charBounds.x + charBounds.width && y >= charBounds.y && y <= charBounds.y + charBounds.height) {
			if (draggedItem.originalParent) {
				draggedItem.originalParent.removeChild(draggedItem);
			} else {
				closet.removeChild(draggedItem);
			}
			currentChar.addClothing(draggedItem);
		}
		draggedItem = null;
	}
};
game.update = function () {
	// Update game logic here if needed
};
// Start with first music track
LK.playMusic('jukebox1'); ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,324 @@
-/****
+/**** 
+* Plugins
+****/ 
+var tween = LK.import("@upit/tween.v1");
+
+/**** 
+* Classes
+****/ 
+var Camera = Container.expand(function () {
+	var self = Container.call(this);
+	var cameraGraphics = self.attachAsset('camera', {
+		anchorX: 0.5,
+		anchorY: 0.5
+	});
+	var lensText = new Text2('📷', {
+		size: 40,
+		fill: 0xFFFFFF
+	});
+	lensText.anchor.set(0.5, 0.5);
+	self.addChild(lensText);
+	self.down = function (x, y, obj) {
+		LK.getSound('cameraClick').play();
+		LK.effects.flashScreen(0xFFFFFF, 300);
+		tween(self, {
+			scaleX: 0.8,
+			scaleY: 0.8
+		}, {
+			duration: 150,
+			onFinish: function onFinish() {
+				tween(self, {
+					scaleX: 1,
+					scaleY: 1
+				}, {
+					duration: 150
+				});
+			}
+		});
+	};
+	return self;
+});
+var Character = Container.expand(function (name, hairColor) {
+	var self = Container.call(this);
+	self.name = name;
+	self.wornItems = [];
+	var body = self.attachAsset('characterBase', {
+		anchorX: 0.5,
+		anchorY: 1
+	});
+	var hair = self.attachAsset(name === 'Ginger' ? 'gingerHair' : 'harveyHair', {
+		anchorX: 0.5,
+		anchorY: 0.5,
+		y: -480
+	});
+	self.addClothing = function (item) {
+		if (item.type === 'shirt') {
+			item.x = 0;
+			item.y = -300;
+		} else if (item.type === 'pants') {
+			item.x = 0;
+			item.y = -150;
+		} else if (item.type === 'dress') {
+			item.x = 0;
+			item.y = -200;
+		} else if (item.type === 'hat') {
+			item.x = 0;
+			item.y = -520;
+		} else if (item.type === 'shoes') {
+			item.x = 0;
+			item.y = 0;
+		}
+		self.addChild(item);
+		item.isWorn = true;
+		self.wornItems.push(item);
+		LK.getSound('dressSound').play();
+	};
+	self.removeClothing = function (item) {
+		if (item.isWorn) {
+			var index = self.wornItems.indexOf(item);
+			if (index > -1) {
+				self.wornItems.splice(index, 1);
+			}
+			item.isWorn = false;
+			self.removeChild(item);
+			closet.addChild(item);
+			item.x = Math.random() * 200 - 100;
+			item.y = Math.random() * 300 - 150;
+		}
+	};
+	return self;
+});
+var ClothingItem = Container.expand(function (type, color, size) {
+	var self = Container.call(this);
+	self.type = type;
+	self.originalParent = null;
+	self.isWorn = false;
+	var itemGraphics = self.attachAsset('clothingItem', {
+		anchorX: 0.5,
+		anchorY: 0.5,
+		scaleX: size || 1,
+		scaleY: size || 1
+	});
+	if (color) {
+		itemGraphics.tint = color;
+	}
+	self.down = function (x, y, obj) {
+		if (!self.isWorn) {
+			draggedItem = self;
+			dragOffset.x = x;
+			dragOffset.y = y;
+			LK.getSound('clickSound').play();
+		}
+	};
+	return self;
+});
+var Jukebox = Container.expand(function () {
+	var self = Container.call(this);
+	self.currentTrack = 0;
+	self.tracks = ['jukebox1', 'jukebox2', 'jukebox3'];
+	var jukeboxGraphics = self.attachAsset('jukebox', {
+		anchorX: 0.5,
+		anchorY: 0.5
+	});
+	var playText = new Text2('♪', {
+		size: 60,
+		fill: 0xFFD700
+	});
+	playText.anchor.set(0.5, 0.5);
+	self.addChild(playText);
+	self.down = function (x, y, obj) {
+		self.currentTrack = (self.currentTrack + 1) % self.tracks.length;
+		LK.playMusic(self.tracks[self.currentTrack]);
+		LK.getSound('clickSound').play();
+		tween(playText, {
+			scaleX: 1.3,
+			scaleY: 1.3
+		}, {
+			duration: 200,
+			onFinish: function onFinish() {
+				tween(playText, {
+					scaleX: 1,
+					scaleY: 1
+				}, {
+					duration: 200
+				});
+			}
+		});
+	};
+	return self;
+});
+
+/**** 
 * Initialize Game
-****/
+****/ 
 var game = new LK.Game({
-	backgroundColor: 0x000000
-});
\ No newline at end of file
+	backgroundColor: 0xF5E6D3
+});
+
+/**** 
+* Game Code
+****/ 
+var gameState = 'characterSelect';
+var selectedCharacter = null;
+var ginger = null;
+var harvey = null;
+var closet = null;
+var draggedItem = null;
+var dragOffset = {
+	x: 0,
+	y: 0
+};
+var jukebox = null;
+var camera = null;
+var clothingItems = [];
+// Character selection buttons
+var gingerButton = game.addChild(LK.getAsset('selectButton', {
+	anchorX: 0.5,
+	anchorY: 0.5,
+	x: 2048 / 4,
+	y: 2732 / 2,
+	tint: 0xFF69B4
+}));
+var gingerText = new Text2('Ginger', {
+	size: 40,
+	fill: 0xFFFFFF
+});
+gingerText.anchor.set(0.5, 0.5);
+gingerButton.addChild(gingerText);
+var harveyButton = game.addChild(LK.getAsset('selectButton', {
+	anchorX: 0.5,
+	anchorY: 0.5,
+	x: 3 * 2048 / 4,
+	y: 2732 / 2,
+	tint: 0x4169E1
+}));
+var harveyText = new Text2('Harvey', {
+	size: 40,
+	fill: 0xFFFFFF
+});
+harveyText.anchor.set(0.5, 0.5);
+harveyButton.addChild(harveyText);
+var titleText = new Text2('Choose Your Character', {
+	size: 80,
+	fill: 0x8B4513
+});
+titleText.anchor.set(0.5, 0.5);
+titleText.x = 2048 / 2;
+titleText.y = 2732 / 3;
+game.addChild(titleText);
+function initializeGame() {
+	// Remove selection UI
+	game.removeChild(gingerButton);
+	game.removeChild(harveyButton);
+	game.removeChild(titleText);
+	// Create characters
+	ginger = new Character('Ginger', 0xD2691E);
+	harvey = new Character('Harvey', 0x8B4513);
+	// Position selected character
+	if (selectedCharacter === 'Ginger') {
+		ginger.x = 2048 / 2;
+		ginger.y = 2732 - 200;
+		game.addChild(ginger);
+	} else {
+		harvey.x = 2048 / 2;
+		harvey.y = 2732 - 200;
+		game.addChild(harvey);
+	}
+	// Create closet
+	closet = game.addChild(LK.getAsset('closet', {
+		anchorX: 0.5,
+		anchorY: 0.5,
+		x: 150,
+		y: 2732 / 2
+	}));
+	// Create clothing items
+	var clothing = [{
+		type: 'shirt',
+		color: 0x4169E1,
+		count: 3
+	}, {
+		type: 'pants',
+		color: 0x2F4F4F,
+		count: 2
+	}, {
+		type: 'dress',
+		color: 0xFF69B4,
+		count: 2
+	}, {
+		type: 'hat',
+		color: 0x8B0000,
+		count: 2
+	}, {
+		type: 'shoes',
+		color: 0x654321,
+		count: 2
+	}];
+	clothing.forEach(function (clothingType, typeIndex) {
+		for (var i = 0; i < clothingType.count; i++) {
+			var item = new ClothingItem(clothingType.type, clothingType.color, 0.8);
+			item.x = i * 80 - 100;
+			item.y = typeIndex * 80 - 200;
+			closet.addChild(item);
+			clothingItems.push(item);
+		}
+	});
+	// Create jukebox
+	jukebox = game.addChild(new Jukebox());
+	jukebox.x = 2048 - 150;
+	jukebox.y = 300;
+	// Create camera
+	camera = game.addChild(new Camera());
+	camera.x = 2048 - 150;
+	camera.y = 2732 - 300;
+	gameState = 'dressup';
+}
+game.down = function (x, y, obj) {
+	if (gameState === 'characterSelect') {
+		var localPos = gingerButton.toLocal({
+			x: x,
+			y: y
+		});
+		if (localPos.x >= -100 && localPos.x <= 100 && localPos.y >= -40 && localPos.y <= 40) {
+			selectedCharacter = 'Ginger';
+			LK.getSound('clickSound').play();
+			initializeGame();
+			return;
+		}
+		localPos = harveyButton.toLocal({
+			x: x,
+			y: y
+		});
+		if (localPos.x >= -100 && localPos.x <= 100 && localPos.y >= -40 && localPos.y <= 40) {
+			selectedCharacter = 'Harvey';
+			LK.getSound('clickSound').play();
+			initializeGame();
+			return;
+		}
+	}
+};
+game.move = function (x, y, obj) {
+	if (draggedItem && gameState === 'dressup') {
+		draggedItem.x = x - dragOffset.x;
+		draggedItem.y = y - dragOffset.y;
+	}
+};
+game.up = function (x, y, obj) {
+	if (draggedItem && gameState === 'dressup') {
+		var currentChar = selectedCharacter === 'Ginger' ? ginger : harvey;
+		var charBounds = currentChar.getBounds();
+		if (x >= charBounds.x && x <= charBounds.x + charBounds.width && y >= charBounds.y && y <= charBounds.y + charBounds.height) {
+			if (draggedItem.originalParent) {
+				draggedItem.originalParent.removeChild(draggedItem);
+			} else {
+				closet.removeChild(draggedItem);
+			}
+			currentChar.addClothing(draggedItem);
+		}
+		draggedItem = null;
+	}
+};
+game.update = function () {
+	// Update game logic here if needed
+};
+// Start with first music track
+LK.playMusic('jukebox1');
\ No newline at end of file