/**** 
* Plugins
****/ 
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x000000
});
/**** 
* Game Code
****/ 
// Set background
game.setBackgroundColor(0x87CEEB);
// Emoji categories and progression
var emojiCategories = {
	basic: ['๐', '๐', '๐'],
	emotions: ['๐', '๐ฎ', '๐ข', '๐ฑ', '๐คข', '๐ท', '๐ต', '๐คฏ'],
	bodily: ['๐คฎ', '๐ฉ', '๐คง', '๐ช'],
	food: ['๐', '๐', '๐', '๐', '๐ฐ', '๐ฅ', '๐', '๐'],
	animals: ['๐ถ', '๐ฑ', '๐ญ', '๐ป', '๐ฆ', '๐ธ', '๐ท', '๐ฆ'],
	flags: ['๐บ๐ธ', '๐ฌ๐ง', '๐ซ๐ท', '๐ฏ๐ต', '๐ฉ๐ช', '๐ฎ๐น', '๐จ๐ฆ', '๐ง๐ท'],
	colors: ['๐ด', '๐ต', '๐ข', '๐ก', '๐ฃ', '๐ ', 'โซ', 'โช'],
	utensils: ['๐ด', '๐ฅ', '๐ช', '๐ฝ๏ธ', '๐ฅข', '๐ง', '๐ท', 'โ']
};
var categoryOrder = ['basic', 'emotions', 'bodily', 'food', 'animals', 'flags', 'colors', 'utensils'];
// Game state
var clickCount = storage.clickCount || 0;
var totalScore = storage.totalScore || 0;
var currentCategory = storage.currentCategory || 'basic';
var currentEmojiIndex = storage.currentEmojiIndex || 0;
// Create main emoji display
var emojiContainer = game.addChild(new Container());
emojiContainer.x = 2048 / 2;
emojiContainer.y = 2732 / 2;
var emojiBase = emojiContainer.attachAsset('emojiBase', {
	anchorX: 0.5,
	anchorY: 0.5
});
var emojiText = new Text2(emojiCategories[currentCategory][currentEmojiIndex], {
	size: 120,
	fill: 0x000000
});
emojiText.anchor.set(0.5, 0.5);
emojiContainer.addChild(emojiText);
// Score display
var scoreText = new Text2('Clicks: ' + clickCount, {
	size: 60,
	fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
// Progress display
var progressText = new Text2('Next evolution in: ' + (30 - clickCount % 30) + ' clicks', {
	size: 40,
	fill: 0xFFFFFF
});
progressText.anchor.set(0.5, 0);
progressText.y = 80;
LK.gui.top.addChild(progressText);
// Category display
var categoryText = new Text2('Category: ' + currentCategory.toUpperCase(), {
	size: 35,
	fill: 0xFFD700
});
categoryText.anchor.set(0.5, 1);
LK.gui.bottom.addChild(categoryText);
function updateEmoji() {
	var categoryIndex = categoryOrder.indexOf(currentCategory);
	var currentEmojis = emojiCategories[currentCategory];
	// Get next emoji in current category
	currentEmojiIndex = (currentEmojiIndex + 1) % currentEmojis.length;
	// If we've cycled through all emojis in category and have more categories
	if (currentEmojiIndex === 0 && categoryIndex < categoryOrder.length - 1) {
		currentCategory = categoryOrder[categoryIndex + 1];
		currentEmojis = emojiCategories[currentCategory];
		categoryText.setText('Category: ' + currentCategory.toUpperCase());
	}
	emojiText.setText(currentEmojis[currentEmojiIndex]);
	// Save progress
	storage.currentCategory = currentCategory;
	storage.currentEmojiIndex = currentEmojiIndex;
}
function handleClick() {
	clickCount++;
	totalScore++;
	// Update displays
	scoreText.setText('Clicks: ' + clickCount);
	progressText.setText('Next evolution in: ' + (30 - clickCount % 30) + ' clicks');
	// Click animation
	tween.stop(emojiContainer, {
		scaleX: true,
		scaleY: true
	});
	tween(emojiContainer, {
		scaleX: 1.2,
		scaleY: 1.2
	}, {
		duration: 100,
		easing: tween.easeOut,
		onFinish: function onFinish() {
			tween(emojiContainer, {
				scaleX: 1,
				scaleY: 1
			}, {
				duration: 100,
				easing: tween.easeIn
			});
		}
	});
	// Check for evolution
	if (clickCount % 30 === 0) {
		updateEmoji();
		// Evolution animation
		tween(emojiContainer, {
			scaleX: 1.5,
			scaleY: 1.5,
			rotation: Math.PI * 2
		}, {
			duration: 500,
			easing: tween.bounceOut,
			onFinish: function onFinish() {
				emojiContainer.rotation = 0;
				tween(emojiContainer, {
					scaleX: 1,
					scaleY: 1
				}, {
					duration: 200,
					easing: tween.easeOut
				});
			}
		});
		// Flash effect
		LK.effects.flashScreen(0xFFD700, 300);
	}
	// Play sound
	LK.getSound('clickSound').play();
	// Save progress
	storage.clickCount = clickCount;
	storage.totalScore = totalScore;
}
// Click handler
emojiContainer.down = function (x, y, obj) {
	handleClick();
};
// Make sure the emoji is interactive
emojiContainer.interactive = true; /**** 
* Plugins
****/ 
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x000000
});
/**** 
* Game Code
****/ 
// Set background
game.setBackgroundColor(0x87CEEB);
// Emoji categories and progression
var emojiCategories = {
	basic: ['๐', '๐', '๐'],
	emotions: ['๐', '๐ฎ', '๐ข', '๐ฑ', '๐คข', '๐ท', '๐ต', '๐คฏ'],
	bodily: ['๐คฎ', '๐ฉ', '๐คง', '๐ช'],
	food: ['๐', '๐', '๐', '๐', '๐ฐ', '๐ฅ', '๐', '๐'],
	animals: ['๐ถ', '๐ฑ', '๐ญ', '๐ป', '๐ฆ', '๐ธ', '๐ท', '๐ฆ'],
	flags: ['๐บ๐ธ', '๐ฌ๐ง', '๐ซ๐ท', '๐ฏ๐ต', '๐ฉ๐ช', '๐ฎ๐น', '๐จ๐ฆ', '๐ง๐ท'],
	colors: ['๐ด', '๐ต', '๐ข', '๐ก', '๐ฃ', '๐ ', 'โซ', 'โช'],
	utensils: ['๐ด', '๐ฅ', '๐ช', '๐ฝ๏ธ', '๐ฅข', '๐ง', '๐ท', 'โ']
};
var categoryOrder = ['basic', 'emotions', 'bodily', 'food', 'animals', 'flags', 'colors', 'utensils'];
// Game state
var clickCount = storage.clickCount || 0;
var totalScore = storage.totalScore || 0;
var currentCategory = storage.currentCategory || 'basic';
var currentEmojiIndex = storage.currentEmojiIndex || 0;
// Create main emoji display
var emojiContainer = game.addChild(new Container());
emojiContainer.x = 2048 / 2;
emojiContainer.y = 2732 / 2;
var emojiBase = emojiContainer.attachAsset('emojiBase', {
	anchorX: 0.5,
	anchorY: 0.5
});
var emojiText = new Text2(emojiCategories[currentCategory][currentEmojiIndex], {
	size: 120,
	fill: 0x000000
});
emojiText.anchor.set(0.5, 0.5);
emojiContainer.addChild(emojiText);
// Score display
var scoreText = new Text2('Clicks: ' + clickCount, {
	size: 60,
	fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
// Progress display
var progressText = new Text2('Next evolution in: ' + (30 - clickCount % 30) + ' clicks', {
	size: 40,
	fill: 0xFFFFFF
});
progressText.anchor.set(0.5, 0);
progressText.y = 80;
LK.gui.top.addChild(progressText);
// Category display
var categoryText = new Text2('Category: ' + currentCategory.toUpperCase(), {
	size: 35,
	fill: 0xFFD700
});
categoryText.anchor.set(0.5, 1);
LK.gui.bottom.addChild(categoryText);
function updateEmoji() {
	var categoryIndex = categoryOrder.indexOf(currentCategory);
	var currentEmojis = emojiCategories[currentCategory];
	// Get next emoji in current category
	currentEmojiIndex = (currentEmojiIndex + 1) % currentEmojis.length;
	// If we've cycled through all emojis in category and have more categories
	if (currentEmojiIndex === 0 && categoryIndex < categoryOrder.length - 1) {
		currentCategory = categoryOrder[categoryIndex + 1];
		currentEmojis = emojiCategories[currentCategory];
		categoryText.setText('Category: ' + currentCategory.toUpperCase());
	}
	emojiText.setText(currentEmojis[currentEmojiIndex]);
	// Save progress
	storage.currentCategory = currentCategory;
	storage.currentEmojiIndex = currentEmojiIndex;
}
function handleClick() {
	clickCount++;
	totalScore++;
	// Update displays
	scoreText.setText('Clicks: ' + clickCount);
	progressText.setText('Next evolution in: ' + (30 - clickCount % 30) + ' clicks');
	// Click animation
	tween.stop(emojiContainer, {
		scaleX: true,
		scaleY: true
	});
	tween(emojiContainer, {
		scaleX: 1.2,
		scaleY: 1.2
	}, {
		duration: 100,
		easing: tween.easeOut,
		onFinish: function onFinish() {
			tween(emojiContainer, {
				scaleX: 1,
				scaleY: 1
			}, {
				duration: 100,
				easing: tween.easeIn
			});
		}
	});
	// Check for evolution
	if (clickCount % 30 === 0) {
		updateEmoji();
		// Evolution animation
		tween(emojiContainer, {
			scaleX: 1.5,
			scaleY: 1.5,
			rotation: Math.PI * 2
		}, {
			duration: 500,
			easing: tween.bounceOut,
			onFinish: function onFinish() {
				emojiContainer.rotation = 0;
				tween(emojiContainer, {
					scaleX: 1,
					scaleY: 1
				}, {
					duration: 200,
					easing: tween.easeOut
				});
			}
		});
		// Flash effect
		LK.effects.flashScreen(0xFFD700, 300);
	}
	// Play sound
	LK.getSound('clickSound').play();
	// Save progress
	storage.clickCount = clickCount;
	storage.totalScore = totalScore;
}
// Click handler
emojiContainer.down = function (x, y, obj) {
	handleClick();
};
// Make sure the emoji is interactive
emojiContainer.interactive = true;