Code edit (1 edits merged)
Please save this source code
User prompt
PowerPuff Feelings Adventure
Initial prompt
Toca feelings (2016). The powerpuff girls have made a new friend š¦ named āLucas the lion cub.ā Tap on level 1 happy tap on the powerpuff girls and Lucas to pull a happy face, level 2 sad tap on the powerpuff girls and Lucas to pull a sad face, level 3 cry tap on the powerpuff girls and Lucas to pull a cry face, level 4 fear tap on the powerpuff girls and Lucas to pull a fear face, or level 5 angry tap on the powerpuff girls and Lucas to pull an angry face.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var PowerPuffCharacter = Container.expand(function (characterType, emotionType) { var self = Container.call(this); // Character base var characterBase = self.attachAsset(characterType, { anchorX: 0.5, anchorY: 0.5 }); // Eyes var leftEye = self.attachAsset(emotionType + 'Eye', { anchorX: 0.5, anchorY: 0.5, x: -60, y: -40 }); var rightEye = self.attachAsset(emotionType + 'Eye', { anchorX: 0.5, anchorY: 0.5, x: 60, y: -40 }); // Mouth var mouth = self.attachAsset(emotionType + 'Mouth', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 80 }); // Additional features based on emotion var additionalFeatures = []; if (emotionType === 'cry') { var leftTear = self.attachAsset('tear', { anchorX: 0.5, anchorY: 0.5, x: -60, y: 20 }); var rightTear = self.attachAsset('tear', { anchorX: 0.5, anchorY: 0.5, x: 60, y: 20 }); additionalFeatures.push(leftTear, rightTear); } if (emotionType === 'angry') { var leftBrow = self.attachAsset('angryBrow', { anchorX: 0.5, anchorY: 0.5, x: -60, y: -80, rotation: -0.3 }); var rightBrow = self.attachAsset('angryBrow', { anchorX: 0.5, anchorY: 0.5, x: 60, y: -80, rotation: 0.3 }); additionalFeatures.push(leftBrow, rightBrow); } self.characterType = characterType; self.emotionType = emotionType; self.isActivated = false; self.activate = function () { if (!self.isActivated) { self.isActivated = true; // Animation feedback tween(self, { scaleX: 1.3, scaleY: 1.3 }, { duration: 200, easing: tween.bounceOut, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.bounceOut }); } }); // Visual feedback LK.effects.flashObject(self, 0xffffff, 300); // Play tap sound LK.getSound('tap').play(); } }; self.down = function (x, y, obj) { self.activate(); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87ceeb }); /**** * Game Code ****/ // Facial features // PowerPuff Girls Characters var currentLevel = 1; var maxLevel = 5; var characters = []; var emotions = ['happy', 'sad', 'cry', 'fear', 'angry']; var characterTypes = ['blossom', 'bubbles', 'buttercup', 'lucas']; // UI Elements var levelText = new Text2('Level 1: Happy', { size: 80, fill: 0xFFFFFF }); levelText.anchor.set(0.5, 0); LK.gui.top.addChild(levelText); var instructionText = new Text2('Tap each character to help them express emotions!', { size: 60, fill: 0xFFFFFF }); instructionText.anchor.set(0.5, 0); instructionText.y = 120; LK.gui.top.addChild(instructionText); function createLevel(level) { // Clear existing characters for (var i = 0; i < characters.length; i++) { characters[i].destroy(); } characters = []; var emotion = emotions[level - 1]; var positions = [{ x: 512, y: 1200 }, // Blossom { x: 1536, y: 1200 }, // Bubbles { x: 512, y: 1900 }, // Buttercup { x: 1536, y: 1900 } // Lucas ]; // Create characters for current level for (var i = 0; i < characterTypes.length; i++) { var character = new PowerPuffCharacter(characterTypes[i], emotion); character.x = positions[i].x; character.y = positions[i].y; characters.push(character); game.addChild(character); } // Update UI var emotionNames = ['Happy', 'Sad', 'Cry', 'Fear', 'Angry']; levelText.setText('Level ' + level + ': ' + emotionNames[level - 1]); var instructions = ['Tap each character to make them smile!', 'Tap each character to make them sad!', 'Tap each character to make them cry!', 'Tap each character to make them scared!', 'Tap each character to make them angry!']; instructionText.setText(instructions[level - 1]); } function checkLevelComplete() { var allActivated = true; for (var i = 0; i < characters.length; i++) { if (!characters[i].isActivated) { allActivated = false; break; } } if (allActivated) { LK.getSound('levelComplete').play(); // Flash screen with success color LK.effects.flashScreen(0x00ff00, 1000); // Advance to next level after delay LK.setTimeout(function () { currentLevel++; if (currentLevel > maxLevel) { // Game completed LK.showYouWin(); } else { createLevel(currentLevel); } }, 1500); } } // Initialize first level createLevel(currentLevel); game.update = function () { // Check if current level is complete if (characters.length > 0) { checkLevelComplete(); } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var PowerPuffCharacter = Container.expand(function (characterType, emotionType) {
var self = Container.call(this);
// Character base
var characterBase = self.attachAsset(characterType, {
anchorX: 0.5,
anchorY: 0.5
});
// Eyes
var leftEye = self.attachAsset(emotionType + 'Eye', {
anchorX: 0.5,
anchorY: 0.5,
x: -60,
y: -40
});
var rightEye = self.attachAsset(emotionType + 'Eye', {
anchorX: 0.5,
anchorY: 0.5,
x: 60,
y: -40
});
// Mouth
var mouth = self.attachAsset(emotionType + 'Mouth', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 80
});
// Additional features based on emotion
var additionalFeatures = [];
if (emotionType === 'cry') {
var leftTear = self.attachAsset('tear', {
anchorX: 0.5,
anchorY: 0.5,
x: -60,
y: 20
});
var rightTear = self.attachAsset('tear', {
anchorX: 0.5,
anchorY: 0.5,
x: 60,
y: 20
});
additionalFeatures.push(leftTear, rightTear);
}
if (emotionType === 'angry') {
var leftBrow = self.attachAsset('angryBrow', {
anchorX: 0.5,
anchorY: 0.5,
x: -60,
y: -80,
rotation: -0.3
});
var rightBrow = self.attachAsset('angryBrow', {
anchorX: 0.5,
anchorY: 0.5,
x: 60,
y: -80,
rotation: 0.3
});
additionalFeatures.push(leftBrow, rightBrow);
}
self.characterType = characterType;
self.emotionType = emotionType;
self.isActivated = false;
self.activate = function () {
if (!self.isActivated) {
self.isActivated = true;
// Animation feedback
tween(self, {
scaleX: 1.3,
scaleY: 1.3
}, {
duration: 200,
easing: tween.bounceOut,
onFinish: function onFinish() {
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 200,
easing: tween.bounceOut
});
}
});
// Visual feedback
LK.effects.flashObject(self, 0xffffff, 300);
// Play tap sound
LK.getSound('tap').play();
}
};
self.down = function (x, y, obj) {
self.activate();
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87ceeb
});
/****
* Game Code
****/
// Facial features
// PowerPuff Girls Characters
var currentLevel = 1;
var maxLevel = 5;
var characters = [];
var emotions = ['happy', 'sad', 'cry', 'fear', 'angry'];
var characterTypes = ['blossom', 'bubbles', 'buttercup', 'lucas'];
// UI Elements
var levelText = new Text2('Level 1: Happy', {
size: 80,
fill: 0xFFFFFF
});
levelText.anchor.set(0.5, 0);
LK.gui.top.addChild(levelText);
var instructionText = new Text2('Tap each character to help them express emotions!', {
size: 60,
fill: 0xFFFFFF
});
instructionText.anchor.set(0.5, 0);
instructionText.y = 120;
LK.gui.top.addChild(instructionText);
function createLevel(level) {
// Clear existing characters
for (var i = 0; i < characters.length; i++) {
characters[i].destroy();
}
characters = [];
var emotion = emotions[level - 1];
var positions = [{
x: 512,
y: 1200
},
// Blossom
{
x: 1536,
y: 1200
},
// Bubbles
{
x: 512,
y: 1900
},
// Buttercup
{
x: 1536,
y: 1900
} // Lucas
];
// Create characters for current level
for (var i = 0; i < characterTypes.length; i++) {
var character = new PowerPuffCharacter(characterTypes[i], emotion);
character.x = positions[i].x;
character.y = positions[i].y;
characters.push(character);
game.addChild(character);
}
// Update UI
var emotionNames = ['Happy', 'Sad', 'Cry', 'Fear', 'Angry'];
levelText.setText('Level ' + level + ': ' + emotionNames[level - 1]);
var instructions = ['Tap each character to make them smile!', 'Tap each character to make them sad!', 'Tap each character to make them cry!', 'Tap each character to make them scared!', 'Tap each character to make them angry!'];
instructionText.setText(instructions[level - 1]);
}
function checkLevelComplete() {
var allActivated = true;
for (var i = 0; i < characters.length; i++) {
if (!characters[i].isActivated) {
allActivated = false;
break;
}
}
if (allActivated) {
LK.getSound('levelComplete').play();
// Flash screen with success color
LK.effects.flashScreen(0x00ff00, 1000);
// Advance to next level after delay
LK.setTimeout(function () {
currentLevel++;
if (currentLevel > maxLevel) {
// Game completed
LK.showYouWin();
} else {
createLevel(currentLevel);
}
}, 1500);
}
}
// Initialize first level
createLevel(currentLevel);
game.update = function () {
// Check if current level is complete
if (characters.length > 0) {
checkLevelComplete();
}
};