User prompt
Make it animation youwinWoman and youwinWoman2 changing 1 second
User prompt
Dublicate youwinWoman for make it a simple animation and name it youwinWoman2 and change it 2seconds time
Code edit (1 edits merged)
Please save this source code
User prompt
When the questions finished make a new screen and put a mini puzzle game in it with a new puzzleWoman asset. Divide the puzzleWoman asset to 9 and make it the whole picture. If you won continue to what and win screen all same.
User prompt
When the questions finished make a new screen and put a mini puzzle game in it with a new puzzleWoman asset. Make 9 pieces that asset and make the true picture for skip it. If you won continue to what and win screen all same.
User prompt
When the questions finished make a new screen and put a mini puzzle game in it with a new puzzleWoman asset. If you won continue to what and win screen all same.
User prompt
When the questions finished make a new screen and put a mini game in it with girl. Chose an exciting mini game. If you won continue to what and win screen
User prompt
When the questions finished make a new screen and put a SOS game in it with girl. If you won continue to what and win screen
User prompt
Move mute button 16px down
User prompt
Move Your score line 17px down
Code edit (1 edits merged)
Please save this source code
User prompt
Move Your score line 30px down
User prompt
Move mute button 30px down
User prompt
Please fix the bug: 'Uncaught TypeError: LK.muteAll is not a function' in or related to this line: 'LK.muteAll();' Line Number: 468
User prompt
Make a mute button for shut the sounds
User prompt
Make a mute button. But it shows after starting screen
User prompt
Move mute button up 50px
User prompt
Add mute button to bottom left after starting screen, toggling all music and sound
User prompt
add a mute button after starting screen. to bottom left corner. When you click it every music and sound silence, until click and open again
User prompt
Burada toplam 13 soru var. 13 sorudan karışık 6 soru görmek gerekiyor her oyunda. Kodda bir hata mı var? Son sorular hiç denk felmiyor. Düzeltelim
User prompt
Move mute button screens bottom left corner
User prompt
Move mute button right 80px
User prompt
Move mute button right 50px
User prompt
Move mute button left for 500px
User prompt
Move mute button left for 200px
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Mini game falling object class
var MiniGameFallingObj = Container.expand(function () {
var self = Container.call(this);
// Randomly choose heart (good) or mouth (bad)
var isHeart = Math.random() < 0.7;
self.isHeart = isHeart;
var assetId = isHeart ? 'heart' : 'mouth';
self.asset = self.attachAsset(assetId, {
anchorX: 0.5,
anchorY: 0.5
});
self.width = self.asset.width;
self.height = self.asset.height;
self.speed = 18 + Math.random() * 8;
self.x = 200 + Math.random() * (2048 - 400);
self.y = -100;
self.update = function () {
self.y += self.speed;
if (self.y > 2732 + 100) {
self.destroy();
var idx = miniGameFallingObjs.indexOf(self);
if (idx !== -1) miniGameFallingObjs.splice(idx, 1);
}
};
return self;
});
// Mini game logic
// Mini game girl class
var MiniGameGirl = Container.expand(function () {
var self = Container.call(this);
self.girl = self.attachAsset('happyWoman', {
anchorX: 0.5,
anchorY: 0.5
});
self.width = self.girl.width;
self.height = self.girl.height;
self.setState = function (state) {
if (self.girl) self.girl.destroy();
var faceId = 'happyWoman';
if (state === 'angry') faceId = 'angryWoman';
if (state === 'surprised') faceId = 'surprisedWoman';
self.girl = self.attachAsset(faceId, {
anchorX: 0.5,
anchorY: 0.5
});
};
return self;
});
// Woman character class
var Woman = Container.expand(function () {
var self = Container.call(this);
// State: 'happy', 'angry', 'surprised'
self.state = 'happy';
// Attach face (default: happy)
self.face = self.attachAsset('happyWoman', {
anchorX: 0.5,
anchorY: 0.5
});
// Attach mouth
self.mouth = self.attachAsset('mouth', {
anchorX: 0.5,
anchorY: 0.5,
x: -15,
// move 3.75mm left (35px left from center, 5mm right from previous)
// centered horizontally, but offset slightly left
y: 40 // move up 1cm (40px from woman's center)
});
// Animate mouth open/close
self.mouthTalking = false;
self.mouthTween = null;
self.setState = function (state) {
if (self.state === state) {
return;
}
self.state = state;
// Remove old face
self.face.destroy();
// Add new face
var faceId = 'happyWoman';
if (state === 'angry') {
faceId = 'angryWoman';
}
if (state === 'surprised') {
faceId = 'surprisedWoman';
}
self.face = self.attachAsset(faceId, {
anchorX: 0.5,
anchorY: 0.5
});
// Keep mouth on top
if (self.mouth && typeof self.mouth.parent !== "undefined" && self.mouth.parent !== null) {
if (typeof self.mouth.parent.removeChild === "function") {
self.mouth.parent.removeChild(self.mouth);
}
}
self.addChild(self.mouth);
// Adjust mouth position based on state
if (state === 'angry') {
self.mouth.x = -25; // Move mouth 10px left from original position (-15 - 10 = -25)
self.mouth.y = 0; // Move mouth 40px up from original position (40 - 40 = 0)
} else {
self.mouth.x = -15; // Reset X to original position
self.mouth.y = 40; // Reset to original position
}
};
self.startTalking = function () {
if (self.mouthTalking) {
return;
}
self.mouthTalking = true;
animateMouth();
};
self.stopTalking = function () {
self.mouthTalking = false;
if (self.mouthTween) {
tween.stop(self.mouth);
self.mouthTween = null;
}
// Reset mouth to closed
self.mouth.scaleY = 1;
};
function animateMouth() {
if (!self.mouthTalking) {
return;
}
// Play WomanTalk sound when mouth starts moving (only if not already playing)
if (!womanTalkPlaying && typeof isMuted !== "undefined" && !isMuted) {
womanTalkPlaying = true;
var soundInstance = LK.getSound('WomanTalk');
soundInstance.play();
// Use sound's actual duration or a longer timeout to ensure sound finishes
LK.setTimeout(function () {
womanTalkPlaying = false;
}, 2000); // Increased timeout to ensure sound completes
}
// Open
self.mouthTween = tween(self.mouth, {
scaleY: 2
}, {
duration: 120,
easing: tween.easeIn,
onFinish: function onFinish() {
// Close
self.mouthTween = tween(self.mouth, {
scaleY: 1
}, {
duration: 120,
easing: tween.easeOut,
onFinish: function onFinish() {
// Repeat if still talking
animateMouth();
}
});
}
});
}
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xf0f0f0
});
/****
* Game Code
****/
// New asset: 'background' (light gray, editable later)
// New asset: 'What' (placeholder, 400x400, editable later)
// Heart (for lives)
// Mouth (Ellipse for talking)
// Surprised Woman (Yellow Square)
// Angry Woman (Purple Square)
// Happy Woman (Red Square)
// Questions and answers
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
function _defineProperty(e, r, t) {
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[r] = t, e;
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
function _toPrimitive(t, r) {
if ("object" != _typeof(t) || !t) {
return t;
}
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof(i)) {
return i;
}
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var questions = [{
text: "Do you know why you are here?",
answers: [{
text: "Yes",
correct: false
}, {
text: "Of course, baby!",
correct: false
}, {
text: "Who am I?",
correct: true
}]
}, {
text: "Do you think I don’t know who you are?",
answers: [{
text: "The Thunderstorm?",
correct: false
}, {
text: "A helpless servant?",
correct: false
}, {
text: "A curious caterpillar?",
correct: true
}]
}, {
text: "Are you curious about me?",
answers: [{
text: "No, about who I am!",
correct: true
}, {
text: "No, about my fate!",
correct: false
}, {
text: "Yes!",
correct: false
}]
}, {
text: "What are you trying to understand?",
answers: [{
text: "Who I am",
correct: true
}, {
text: "The Quantum Theory",
correct: false
}, {
text: "Meaning of life",
correct: false
}]
}, {
text: "Are you a valuable person?",
answers: [{
text: "Am I a person?",
correct: true
}, {
text: "Shine like a diamond",
correct: false
}, {
text: "I am the ONE!",
correct: false
}]
}, {
text: "Who's playing you in this game?",
answers: [{
text: "Someone acting like me",
correct: true
}, {
text: "A finger on a screen",
correct: false
}, {
text: "You, cunning trickster!",
correct: false
}]
}, {
text: "Are you a human?",
answers: [{
text: "Who man?",
correct: true
}, {
text: "I am BATMAN!",
correct: false
}, {
text: "I am a chicken salad",
correct: false
}]
}, {
text: "What do you feel right now?",
answers: [{
text: "Confused but curious",
correct: true
}, {
text: "Need some Turkish Delight",
correct: false
}, {
text: "Like a llama on a treadmill",
correct: false
}]
}, {
text: "Why do you keep answering?",
answers: [{
text: "To learn who I am",
correct: true
}, {
text: "Yes! Why?",
correct: false
}, {
text: "It's fun!",
correct: false
}]
}, {
text: "Do you believe you're real?",
answers: [{
text: "I hope so",
correct: true
}, {
text: "Real! Madrid!",
correct: false
}, {
text: "Not after this game",
correct: false
}]
}, {
text: "What is your greatest fear?",
answers: [{
text: "Not to exist",
correct: true
}, {
text: "Men made of spiders",
correct: false
}, {
text: "Spiders",
correct: false
}]
}, {
text: "Are you kidding me?",
answers: [{
text: "No!",
correct: true
}, {
text: "You are god damn right!",
correct: false
}, {
text: "I am the Joker!",
correct: false
}]
}, {
text: "Where do you think you began?",
answers: [{
text: "I may not have started",
correct: true
}, {
text: "In a hospital",
correct: false
}, {
text: "at Camp Nou",
correct: false
}]
}, {
text: "Who can you fall in love with?",
answers: [{
text: "Can I fall in love?",
correct: true
}, {
text: "You!",
correct: false
}, {
text: "To the hottest",
correct: false
}]
}];
// Shuffle answers for each question
function shuffle(arr) {
for (var i = arr.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
return arr;
}
// Randomly select 6 questions from the available questions
var selectedQuestions = shuffle(questions.slice()).slice(0, 6);
questions = selectedQuestions;
for (var i = 0; i < questions.length; i++) {
questions[i].answers = shuffle(questions[i].answers.slice());
}
// Game state
var currentQuestion = 0;
var hearts = 3;
var maxHearts = 3;
var woman = null;
var answerButtons = [];
var questionText = null;
var heartIcons = [];
var angryTimeout = null;
var surprisedShown = false;
var gameTimer = 30; // Timer in seconds
var timerText = null;
var gameEnded = false;
var showingStartScreen = true;
var startingWomanAsset = null;
var gameNameAsset = null;
var finalScore = 0;
var scoreText = null;
var womanTalkPlaying = false; // Flag to prevent overlapping WomanTalk sounds
// Layout constants
var womanCenterX = 2048 / 2;
var womanCenterY = 900;
var questionY = 1500;
var answerStartY = 1750;
var answerSpacing = 220;
// Add background asset (behind all elements)
var backgroundAsset = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0,
x: 2048 / 2,
y: 0
});
game.addChild(backgroundAsset);
// Add woman character
woman = new Woman();
game.addChild(woman);
woman.x = womanCenterX;
woman.y = womanCenterY;
// Add hearts (below answer buttons, centered)
for (var h = 0; h < maxHearts; h++) {
var heart = LK.getAsset('heart', {
anchorX: 0.5,
anchorY: 0.5
});
// Place below answer buttons, centered horizontally
// Place hearts in a row, centered at 2048/2, below last answer button
var totalWidth = (maxHearts - 1) * 200;
heart.x = 2048 / 2 - totalWidth / 2 + h * 200;
heart.y = answerStartY + 3 * answerSpacing + 150; // 150px below last answer button (moved down 50px)
game.addChild(heart);
heartIcons.push(heart);
}
// Add question text
questionText = new Text2('', {
size: 120,
fill: 0xffffff,
font: "'GillSans-Bold',Impact,'Arial Black',Tahoma"
});
questionText.anchor.set(0.5, 0);
questionText.x = 2048 / 2;
questionText.y = questionY;
game.addChild(questionText);
// Add timer text in top right corner
timerText = new Text2('0:30', {
size: 80,
fill: 0xFFFFFF,
font: "Impact,'Comic Sans MS','Marker Felt','Chalkboard SE',fantasy"
});
timerText.anchor.set(1, 0); // Right-aligned, top
timerText.x = -50; // 50px from right edge (relative to topRight)
timerText.y = 50; // 50px from top
LK.gui.topRight.addChild(timerText);
// --- Mute Button Implementation ---
var isMuted = false;
var muteBtn = new Container();
var muteBg = muteBtn.attachAsset('box', {
width: 120,
height: 120,
color: 0x222222,
anchorX: 0.5,
anchorY: 0.5
});
var muteIcon = new Text2('🔊', {
size: 80,
fill: 0xffffff
});
muteIcon.anchor.set(0.5, 0.5);
muteIcon.x = 0;
muteIcon.y = 0;
muteBtn.addChild(muteIcon);
// Place mute button at top right, below timer (avoid overlap)
muteBtn.x = -50;
muteBtn.y = 246; // moved 16px further down
LK.gui.topRight.addChild(muteBtn);
function updateMuteIcon() {
muteIcon.setText(isMuted ? '🔇' : '🔊');
}
muteBtn.down = function (x, y, obj) {
isMuted = !isMuted;
updateMuteIcon();
if (isMuted) {
// Stop all music and prevent further sounds/music from playing
LK.stopMusic();
} else {
// Optionally, resume music if not muted and game is running
if (!showingStartScreen) {
LK.playMusic('Game');
}
}
};
updateMuteIcon();
// Answer button class
function createAnswerButton(idx) {
var btn = new Container();
// Button background
var bg = btn.attachAsset('box', {
width: 900,
height: 160,
color: 0x000000,
anchorX: 0.5,
anchorY: 0.5
});
// Button text
var txt = new Text2('', {
size: 70,
fill: 0xffffff
});
txt.anchor.set(0.5, 0.5);
txt.x = 0;
txt.y = 0;
btn.addChild(txt);
// Position
btn.x = 2048 / 2;
btn.y = answerStartY + idx * answerSpacing + 100;
// Store for later
btn.bg = bg;
btn.txt = txt;
btn.idx = idx;
// Add to game
game.addChild(btn);
// Touch/click handler
btn.down = function (x, y, obj) {
handleAnswer(idx);
};
return btn;
}
// Create answer buttons
for (var i = 0; i < 3; i++) {
var btn = createAnswerButton(i);
answerButtons.push(btn);
}
// Update hearts display
function updateHearts() {
for (var i = 0; i < heartIcons.length; i++) {
heartIcons[i].alpha = i < hearts ? 1 : 0.2;
}
}
// Show question and answers
function showQuestion() {
if (currentQuestion >= questions.length) {
// Show surprised woman
showSurprised();
return;
}
var q = questions[currentQuestion];
questionText.setText(q.text);
for (var i = 0; i < 3; i++) {
var ans = q.answers[i];
answerButtons[i].txt.setText(ans ? ans.text : '');
answerButtons[i].visible = !!ans;
answerButtons[i].bg.color = 0xf0f0f0;
}
// Woman happy
woman.setState('happy');
woman.startTalking();
// Stop talking after 1.2s
LK.setTimeout(function () {
woman.stopTalking();
}, 1200);
}
// Handle answer selection
function handleAnswer(idx) {
if (gameEnded || currentQuestion >= questions.length) {
return;
}
var q = questions[currentQuestion];
var ans = q.answers[idx];
if (!ans) {
return;
}
// Disable buttons for now
for (var i = 0; i < 3; i++) {
answerButtons[i].down = null;
}
if (ans.correct) {
// Correct: progress
answerButtons[idx].bg.color = 0x83de44; // green
// Play correct answer sound
if (!isMuted) {
LK.getSound('Correct').play();
}
woman.setState('happy');
woman.startTalking();
LK.setTimeout(function () {
woman.stopTalking();
currentQuestion++;
showQuestion();
// Re-enable buttons
for (var i = 0; i < 3; i++) {
answerButtons[i].down = function (i) {
return function (x, y, obj) {
handleAnswer(i);
};
}(i);
}
}, 900);
} else {
// Wrong: lose heart, angry woman, flash
answerButtons[idx].bg.color = 0xff3b3b; // red
// Play wrong answer sound
if (!isMuted) {
LK.getSound('Nein').play();
}
hearts--;
updateHearts();
woman.setState('angry');
woman.startTalking();
LK.effects.flashObject(woman, 0x8e44ad, 300);
// After 3s, return to happy or end game
if (angryTimeout) {
LK.clearTimeout(angryTimeout);
}
angryTimeout = LK.setTimeout(function () {
woman.stopTalking();
if (hearts <= 0) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
return;
}
woman.setState('happy');
// Re-enable buttons
for (var i = 0; i < 3; i++) {
answerButtons[i].down = function (i) {
return function (x, y, obj) {
handleAnswer(i);
};
}(i);
}
}, 3000);
}
}
// Show surprised woman (win)
// Mini game state variables
var miniGameActive = false;
var miniGameGirl = null;
var miniGameHearts = [];
var miniGameFallingObjs = [];
var miniGameScore = 0;
var miniGameTargetScore = 10;
var miniGameTimer = null;
var miniGameTimeLeft = 20;
var miniGameScoreText = null;
var miniGameTimeText = null;
var miniGameLose = false;
// Mini game logic
function startMiniGame() {
miniGameActive = true;
miniGameScore = 0;
miniGameTimeLeft = 20;
miniGameLose = false;
// Hide main game UI
woman.visible = false;
questionText.visible = false;
for (var i = 0; i < answerButtons.length; i++) answerButtons[i].visible = false;
for (var i = 0; i < heartIcons.length; i++) heartIcons[i].visible = false;
timerText.visible = false;
// Add girl at bottom center
miniGameGirl = new MiniGameGirl();
game.addChild(miniGameGirl);
miniGameGirl.x = 2048 / 2;
miniGameGirl.y = 2732 - 350;
// Add 3 hearts (lives) at top left (avoid 100x100 area)
for (var i = 0; i < 3; i++) {
var h = LK.getAsset('heart', {
anchorX: 0.5,
anchorY: 0.5
});
h.x = 160 + i * 120;
h.y = 160;
game.addChild(h);
miniGameHearts.push(h);
}
// Score text
miniGameScoreText = new Text2('0/' + miniGameTargetScore, {
size: 100,
fill: 0xffffff,
font: "'GillSans-Bold',Impact,'Arial Black',Tahoma"
});
miniGameScoreText.anchor.set(0.5, 0);
miniGameScoreText.x = 2048 / 2;
miniGameScoreText.y = 120;
game.addChild(miniGameScoreText);
// Timer text
miniGameTimeText = new Text2('20', {
size: 80,
fill: 0xffffff,
font: "'GillSans-Bold',Impact,'Arial Black',Tahoma"
});
miniGameTimeText.anchor.set(1, 0);
miniGameTimeText.x = 2048 - 80;
miniGameTimeText.y = 120;
game.addChild(miniGameTimeText);
// Touch/move handler for girl
game.move = function (x, y, obj) {
if (!miniGameActive) return;
// Clamp girl to screen
var minX = miniGameGirl.width / 2 + 40;
var maxX = 2048 - miniGameGirl.width / 2 - 40;
miniGameGirl.x = Math.max(minX, Math.min(maxX, x));
};
// Down handler for instant move
game.down = function (x, y, obj) {
if (!miniGameActive) return;
var minX = miniGameGirl.width / 2 + 40;
var maxX = 2048 - miniGameGirl.width / 2 - 40;
miniGameGirl.x = Math.max(minX, Math.min(maxX, x));
};
// Main update loop for mini game
game.update = function () {
if (!miniGameActive) return;
// Spawn falling objects
if (LK.ticks % 18 === 0) {
var obj = new MiniGameFallingObj();
miniGameFallingObjs.push(obj);
game.addChild(obj);
}
// Update all falling objects
for (var i = miniGameFallingObjs.length - 1; i >= 0; i--) {
var obj = miniGameFallingObjs[i];
obj.update();
// Collision with girl
if (Math.abs(obj.x - miniGameGirl.x) < (obj.width + miniGameGirl.width) / 2 - 40 && Math.abs(obj.y - miniGameGirl.y) < (obj.height + miniGameGirl.height) / 2 - 60) {
if (obj.isHeart) {
miniGameScore++;
miniGameScoreText.setText(miniGameScore + '/' + miniGameTargetScore);
if (!isMuted) LK.getSound('Correct').play();
obj.destroy();
miniGameFallingObjs.splice(i, 1);
if (miniGameScore >= miniGameTargetScore) {
finishMiniGame(true);
return;
}
} else {
// Lose a heart
for (var h = 2; h >= 0; h--) {
if (miniGameHearts[h].alpha === 1) {
miniGameHearts[h].alpha = 0.2;
break;
}
}
if (!isMuted) LK.getSound('Nein').play();
obj.destroy();
miniGameFallingObjs.splice(i, 1);
// Check lose
var heartsLeft = 0;
for (var h = 0; h < 3; h++) if (miniGameHearts[h].alpha === 1) heartsLeft++;
if (heartsLeft <= 0) {
finishMiniGame(false);
return;
}
}
}
}
};
// Timer for mini game
miniGameTimer = LK.setInterval(function () {
if (!miniGameActive) return;
miniGameTimeLeft--;
miniGameTimeText.setText('' + miniGameTimeLeft);
if (miniGameTimeLeft <= 0) {
finishMiniGame(false);
}
}, 1000);
}
// End mini game, show result, then continue to What/win screen
function finishMiniGame(won) {
miniGameActive = false;
// Remove all mini game objects
if (miniGameGirl) {
miniGameGirl.destroy();
miniGameGirl = null;
}
for (var i = 0; i < miniGameHearts.length; i++) if (miniGameHearts[i]) miniGameHearts[i].destroy();
miniGameHearts = [];
for (var i = 0; i < miniGameFallingObjs.length; i++) if (miniGameFallingObjs[i]) miniGameFallingObjs[i].destroy();
miniGameFallingObjs = [];
if (miniGameScoreText) {
miniGameScoreText.destroy();
miniGameScoreText = null;
}
if (miniGameTimeText) {
miniGameTimeText.destroy();
miniGameTimeText = null;
}
if (miniGameTimer) {
LK.clearInterval(miniGameTimer);
miniGameTimer = null;
}
// Remove handlers
game.move = null;
game.down = null;
game.update = null;
// Show result message
var resultText = new Text2(won ? "You did it!" : "Try again!", {
size: 180,
fill: won ? 0x83de44 : 0xff3b3b,
font: "'GillSans-Bold','Arial Black Bold',Impact,'Arial Black',Tahoma"
});
resultText.anchor.set(0.5, 0.5);
resultText.x = 2048 / 2;
resultText.y = 2732 / 2;
game.addChild(resultText);
// Show girl face
var resultGirl = LK.getAsset(won ? 'happyWoman' : 'angryWoman', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2 - 400
});
game.addChild(resultGirl);
// After 1.5s, continue (if win: What/win screen, if lose: restart mini game)
LK.setTimeout(function () {
resultText.destroy();
resultGirl.destroy();
if (won) {
// Continue to What/win screen
showWhatWinScreen();
} else {
// Restart mini game
startMiniGame();
}
}, 1500);
}
// Helper to show What/win screen (original showSurprised logic)
function showWhatWinScreen() {
// Show only surprisedWoman face
woman.setState('surprised');
// Calculate final score
var heartPoints = hearts * 100;
var timePoints = gameTimer * 125;
finalScore = heartPoints + timePoints;
LK.setScore(finalScore);
// Add 'What' asset under surprisedWoman
var whatAsset = LK.getAsset('What', {
anchorX: 0.5,
anchorY: 0.5,
x: womanCenterX,
y: womanCenterY + 600 + 300 + 300 - 10 - 20 - 50
});
game.addChild(whatAsset);
// Add score text under What asset
scoreText = new Text2('YOUR SCORE: ' + finalScore, {
size: 150,
fill: 0xDAA520,
font: "'GillSans-Bold','Arial Black Bold',Impact,'Arial Black',Tahoma"
});
scoreText.anchor.set(0.5, 0);
scoreText.x = womanCenterX;
scoreText.y = womanCenterY + 600 + 300 + 300 + 247;
game.addChild(scoreText);
LK.setTimeout(function () {
if (whatAsset && typeof whatAsset.destroy === "function") {
whatAsset.destroy();
}
if (scoreText && typeof scoreText.destroy === "function") {
scoreText.destroy();
}
}, 3000);
LK.setTimeout(function () {
if (woman.mouth && typeof woman.mouth.parent !== "undefined" && woman.mouth.parent !== null) {
if (typeof woman.mouth.parent.removeChild === "function") {
woman.mouth.parent.removeChild(woman.mouth);
}
}
var finalScreenAsset = LK.getAsset('FinalScreenAsset', {
anchorX: 0.5,
anchorY: 0.5,
x: womanCenterX,
y: womanCenterY + 600 + 250 + 400 + 100 - 9 - 19 - 19 - 26 - 26 - 26 - 46 - 26
});
game.addChild(finalScreenAsset);
var youWinScoreText = new Text2('YOUR SCORE: ' + LK.getScore(), {
size: 150,
fill: 0xDAA520,
font: "'GillSans-Bold','Arial Black Bold',Impact,'Arial Black',Tahoma"
});
youWinScoreText.anchor.set(0.5, 1);
youWinScoreText.x = womanCenterX;
youWinScoreText.y = 2732 - 100;
game.addChild(youWinScoreText);
if (woman.face) {
woman.face.destroy();
}
woman.face = woman.attachAsset('youwinWoman', {
anchorX: 0.5,
anchorY: 0.5,
y: -100
});
}, 3000);
for (var i = 0; i < 3; i++) {
answerButtons[i].visible = false;
}
for (var i = 0; i < heartIcons.length; i++) {
heartIcons[i].visible = false;
}
questionText.setText("");
LK.setTimeout(function () {
if (woman.mouth && typeof woman.mouth.parent !== "undefined" && woman.mouth.parent !== null) {
if (typeof woman.mouth.parent.removeChild === "function") {
woman.mouth.parent.removeChild(woman.mouth);
}
}
if (woman.face) {
woman.face.destroy();
}
woman.face = woman.attachAsset('youwinWoman', {
anchorX: 0.5,
anchorY: 0.5,
y: -100
});
LK.setTimeout(function () {
LK.showYouWin();
}, 5000);
}, 3000);
}
// Overwrite showSurprised to launch mini game
function showSurprised() {
if (surprisedShown) return;
surprisedShown = true;
gameEnded = true;
// Remove mouth if present and parent is not undefined/null
if (woman.mouth && typeof woman.mouth.parent !== "undefined" && woman.mouth.parent !== null) {
if (typeof woman.mouth.parent.removeChild === "function") {
woman.mouth.parent.removeChild(woman.mouth);
}
}
// Start the mini game!
startMiniGame();
}
// Timer countdown function
function updateTimer() {
if (gameEnded || showingStartScreen) {
return;
}
gameTimer--;
var minutes = Math.floor(gameTimer / 60);
var seconds = gameTimer % 60;
var timeString = minutes + ':' + (seconds < 10 ? '0' : '') + seconds;
timerText.setText(timeString);
if (gameTimer <= 0) {
gameEnded = true;
questionText.setText("Time is up!");
woman.setState('angry');
LK.effects.flashScreen(0xff0000, 1000);
LK.setTimeout(function () {
LK.showGameOver();
}, 1000);
}
}
// Timer interval will be started after starting screen
var timerInterval = null;
var tapToStartAsset = null;
var tapToStartText = null;
// Show starting screen first
function showStartingScreen() {
// Create starting woman asset
startingWomanAsset = LK.getAsset('startingWoman', {
anchorX: 0.5,
anchorY: 0.5,
x: womanCenterX,
y: womanCenterY,
alpha: 0,
scaleX: 0.5,
scaleY: 0.5
});
game.addChild(startingWomanAsset);
// Animate starting woman entrance
tween(startingWomanAsset, {
alpha: 1,
scaleX: 1,
scaleY: 1
}, {
duration: 800,
easing: tween.elasticOut
});
// Create game name asset
gameNameAsset = LK.getAsset('GameName', {});
game.addChild(gameNameAsset);
// Animate game name entrance with delay
LK.setTimeout(function () {
tween(gameNameAsset, {
alpha: 1,
y: womanCenterY + 400 + 360 + 360 + 200 - 60 - 200 - 160
}, {
duration: 600,
easing: tween.easeOut
});
}, 400);
// Create tap to start asset
tapToStartAsset = LK.getAsset('taptostart', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2 + 400 + 80 + 89 - 50 - 50,
y: womanCenterY + 400 + 360 + 360 + 200 + 200 - 60 - 80,
alpha: 0,
scaleX: 0.8,
scaleY: 0.8
});
game.addChild(tapToStartAsset);
// Animate tap to start entrance with delay and add pulsing effect
LK.setTimeout(function () {
if (tapToStartAsset) {
tween(tapToStartAsset, {
alpha: 1,
scaleX: 1,
scaleY: 1
}, {
duration: 500,
easing: tween.easeOut,
onFinish: function onFinish() {
// Start pulsing animation
function pulse() {
if (tapToStartAsset) {
tween(tapToStartAsset, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (tapToStartAsset) {
tween(tapToStartAsset, {
scaleX: 1,
scaleY: 1
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: pulse
});
}
}
});
}
}
pulse();
}
});
}
}, 800);
// Hide game elements during start screen
woman.visible = false;
questionText.visible = false;
for (var i = 0; i < answerButtons.length; i++) {
answerButtons[i].visible = false;
}
for (var i = 0; i < heartIcons.length; i++) {
heartIcons[i].visible = false;
}
}
// Function to start the game
function startGame() {
if (!showingStartScreen) {
return;
}
// Remove starting screen assets
if (startingWomanAsset) {
startingWomanAsset.destroy();
startingWomanAsset = null;
}
if (gameNameAsset) {
gameNameAsset.destroy();
gameNameAsset = null;
}
if (tapToStartAsset) {
tapToStartAsset.destroy();
tapToStartAsset = null;
}
if (tapToStartText) {
tapToStartText.destroy();
tapToStartText = null;
}
// Show game elements
woman.visible = true;
questionText.visible = true;
timerText.visible = true;
for (var i = 0; i < answerButtons.length; i++) {
answerButtons[i].visible = true;
}
for (var i = 0; i < heartIcons.length; i++) {
heartIcons[i].visible = true;
}
showingStartScreen = false;
// Start the actual game
updateHearts();
showQuestion();
// Start timer countdown
timerInterval = LK.setInterval(updateTimer, 1000);
// Play game music
if (!isMuted) {
LK.playMusic('Game');
}
}
// Add tap to start functionality
game.down = function (x, y, obj) {
if (showingStartScreen) {
startGame();
}
};
// Initial state - show starting screen
showStartingScreen();
// Play game music at beginning screen
if (!isMuted) {
LK.playMusic('Game');
}
// Make sure answer buttons are re-enabled after each question
for (var i = 0; i < 3; i++) {
answerButtons[i].down = function (i) {
return function (x, y, obj) {
handleAnswer(i);
};
}(i);
}
// No dragging or move events needed for this game
// No update loop needed ===================================================================
--- original.js
+++ change.js
@@ -5,8 +5,56 @@
/****
* Classes
****/
+// Mini game falling object class
+var MiniGameFallingObj = Container.expand(function () {
+ var self = Container.call(this);
+ // Randomly choose heart (good) or mouth (bad)
+ var isHeart = Math.random() < 0.7;
+ self.isHeart = isHeart;
+ var assetId = isHeart ? 'heart' : 'mouth';
+ self.asset = self.attachAsset(assetId, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.width = self.asset.width;
+ self.height = self.asset.height;
+ self.speed = 18 + Math.random() * 8;
+ self.x = 200 + Math.random() * (2048 - 400);
+ self.y = -100;
+ self.update = function () {
+ self.y += self.speed;
+ if (self.y > 2732 + 100) {
+ self.destroy();
+ var idx = miniGameFallingObjs.indexOf(self);
+ if (idx !== -1) miniGameFallingObjs.splice(idx, 1);
+ }
+ };
+ return self;
+});
+// Mini game logic
+// Mini game girl class
+var MiniGameGirl = Container.expand(function () {
+ var self = Container.call(this);
+ self.girl = self.attachAsset('happyWoman', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.width = self.girl.width;
+ self.height = self.girl.height;
+ self.setState = function (state) {
+ if (self.girl) self.girl.destroy();
+ var faceId = 'happyWoman';
+ if (state === 'angry') faceId = 'angryWoman';
+ if (state === 'surprised') faceId = 'surprisedWoman';
+ self.girl = self.attachAsset(faceId, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ };
+ return self;
+});
// Woman character class
var Woman = Container.expand(function () {
var self = Container.call(this);
// State: 'happy', 'angry', 'surprised'
@@ -605,215 +653,201 @@
}, 3000);
}
}
// Show surprised woman (win)
-// SOS minigame state
-var sosGameActive = false;
-var sosGameContainer = null;
-var sosGirl = null;
-var sosTiles = [];
-var sosCurrentPlayer = 1; // 1 = player, 2 = girl
-var sosBoard = [];
-var sosWinLine = null;
-var sosStatusText = null;
-var sosTileSize = 260;
-var sosBoardSize = 3;
-var sosGirlAsset = null;
-var sosGirlFace = null;
-var sosGirlY = womanCenterY + 400;
-var sosGameOver = false;
-// Helper: check SOS win
-function checkSOSWin(board) {
- // Returns {winner: 1|2|null, line: [{x,y},...]} or null
- // Check all rows, cols, diags for "SOS"
- for (var y = 0; y < 3; y++) {
- for (var x = 0; x < 1; x++) {
- // Horizontal
- if (board[y][x] && board[y][x + 1] && board[y][x + 2]) {
- if (board[y][x].letter === 'S' && board[y][x + 1].letter === 'O' && board[y][x + 2].letter === 'S') {
- return {
- winner: board[y][x].player,
- line: [{
- x: x,
- y: y
- }, {
- x: x + 1,
- y: y
- }, {
- x: x + 2,
- y: y
- }]
- };
- }
- }
- }
+// Mini game state variables
+var miniGameActive = false;
+var miniGameGirl = null;
+var miniGameHearts = [];
+var miniGameFallingObjs = [];
+var miniGameScore = 0;
+var miniGameTargetScore = 10;
+var miniGameTimer = null;
+var miniGameTimeLeft = 20;
+var miniGameScoreText = null;
+var miniGameTimeText = null;
+var miniGameLose = false;
+// Mini game logic
+function startMiniGame() {
+ miniGameActive = true;
+ miniGameScore = 0;
+ miniGameTimeLeft = 20;
+ miniGameLose = false;
+ // Hide main game UI
+ woman.visible = false;
+ questionText.visible = false;
+ for (var i = 0; i < answerButtons.length; i++) answerButtons[i].visible = false;
+ for (var i = 0; i < heartIcons.length; i++) heartIcons[i].visible = false;
+ timerText.visible = false;
+ // Add girl at bottom center
+ miniGameGirl = new MiniGameGirl();
+ game.addChild(miniGameGirl);
+ miniGameGirl.x = 2048 / 2;
+ miniGameGirl.y = 2732 - 350;
+ // Add 3 hearts (lives) at top left (avoid 100x100 area)
+ for (var i = 0; i < 3; i++) {
+ var h = LK.getAsset('heart', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ h.x = 160 + i * 120;
+ h.y = 160;
+ game.addChild(h);
+ miniGameHearts.push(h);
}
- for (var x = 0; x < 3; x++) {
- for (var y = 0; y < 1; y++) {
- // Vertical
- if (board[y][x] && board[y + 1][x] && board[y + 2][x]) {
- if (board[y][x].letter === 'S' && board[y + 1][x].letter === 'O' && board[y + 2][x].letter === 'S') {
- return {
- winner: board[y][x].player,
- line: [{
- x: x,
- y: y
- }, {
- x: x,
- y: y + 1
- }, {
- x: x,
- y: y + 2
- }]
- };
+ // Score text
+ miniGameScoreText = new Text2('0/' + miniGameTargetScore, {
+ size: 100,
+ fill: 0xffffff,
+ font: "'GillSans-Bold',Impact,'Arial Black',Tahoma"
+ });
+ miniGameScoreText.anchor.set(0.5, 0);
+ miniGameScoreText.x = 2048 / 2;
+ miniGameScoreText.y = 120;
+ game.addChild(miniGameScoreText);
+ // Timer text
+ miniGameTimeText = new Text2('20', {
+ size: 80,
+ fill: 0xffffff,
+ font: "'GillSans-Bold',Impact,'Arial Black',Tahoma"
+ });
+ miniGameTimeText.anchor.set(1, 0);
+ miniGameTimeText.x = 2048 - 80;
+ miniGameTimeText.y = 120;
+ game.addChild(miniGameTimeText);
+ // Touch/move handler for girl
+ game.move = function (x, y, obj) {
+ if (!miniGameActive) return;
+ // Clamp girl to screen
+ var minX = miniGameGirl.width / 2 + 40;
+ var maxX = 2048 - miniGameGirl.width / 2 - 40;
+ miniGameGirl.x = Math.max(minX, Math.min(maxX, x));
+ };
+ // Down handler for instant move
+ game.down = function (x, y, obj) {
+ if (!miniGameActive) return;
+ var minX = miniGameGirl.width / 2 + 40;
+ var maxX = 2048 - miniGameGirl.width / 2 - 40;
+ miniGameGirl.x = Math.max(minX, Math.min(maxX, x));
+ };
+ // Main update loop for mini game
+ game.update = function () {
+ if (!miniGameActive) return;
+ // Spawn falling objects
+ if (LK.ticks % 18 === 0) {
+ var obj = new MiniGameFallingObj();
+ miniGameFallingObjs.push(obj);
+ game.addChild(obj);
+ }
+ // Update all falling objects
+ for (var i = miniGameFallingObjs.length - 1; i >= 0; i--) {
+ var obj = miniGameFallingObjs[i];
+ obj.update();
+ // Collision with girl
+ if (Math.abs(obj.x - miniGameGirl.x) < (obj.width + miniGameGirl.width) / 2 - 40 && Math.abs(obj.y - miniGameGirl.y) < (obj.height + miniGameGirl.height) / 2 - 60) {
+ if (obj.isHeart) {
+ miniGameScore++;
+ miniGameScoreText.setText(miniGameScore + '/' + miniGameTargetScore);
+ if (!isMuted) LK.getSound('Correct').play();
+ obj.destroy();
+ miniGameFallingObjs.splice(i, 1);
+ if (miniGameScore >= miniGameTargetScore) {
+ finishMiniGame(true);
+ return;
+ }
+ } else {
+ // Lose a heart
+ for (var h = 2; h >= 0; h--) {
+ if (miniGameHearts[h].alpha === 1) {
+ miniGameHearts[h].alpha = 0.2;
+ break;
+ }
+ }
+ if (!isMuted) LK.getSound('Nein').play();
+ obj.destroy();
+ miniGameFallingObjs.splice(i, 1);
+ // Check lose
+ var heartsLeft = 0;
+ for (var h = 0; h < 3; h++) if (miniGameHearts[h].alpha === 1) heartsLeft++;
+ if (heartsLeft <= 0) {
+ finishMiniGame(false);
+ return;
+ }
}
}
}
- }
- // Diagonals
- if (board[0][0] && board[1][1] && board[2][2]) {
- if (board[0][0].letter === 'S' && board[1][1].letter === 'O' && board[2][2].letter === 'S') {
- return {
- winner: board[0][0].player,
- line: [{
- x: 0,
- y: 0
- }, {
- x: 1,
- y: 1
- }, {
- x: 2,
- y: 2
- }]
- };
+ };
+ // Timer for mini game
+ miniGameTimer = LK.setInterval(function () {
+ if (!miniGameActive) return;
+ miniGameTimeLeft--;
+ miniGameTimeText.setText('' + miniGameTimeLeft);
+ if (miniGameTimeLeft <= 0) {
+ finishMiniGame(false);
}
+ }, 1000);
+}
+// End mini game, show result, then continue to What/win screen
+function finishMiniGame(won) {
+ miniGameActive = false;
+ // Remove all mini game objects
+ if (miniGameGirl) {
+ miniGameGirl.destroy();
+ miniGameGirl = null;
}
- if (board[0][2] && board[1][1] && board[2][0]) {
- if (board[0][2].letter === 'S' && board[1][1].letter === 'O' && board[2][0].letter === 'S') {
- return {
- winner: board[0][2].player,
- line: [{
- x: 2,
- y: 0
- }, {
- x: 1,
- y: 1
- }, {
- x: 0,
- y: 2
- }]
- };
- }
+ for (var i = 0; i < miniGameHearts.length; i++) if (miniGameHearts[i]) miniGameHearts[i].destroy();
+ miniGameHearts = [];
+ for (var i = 0; i < miniGameFallingObjs.length; i++) if (miniGameFallingObjs[i]) miniGameFallingObjs[i].destroy();
+ miniGameFallingObjs = [];
+ if (miniGameScoreText) {
+ miniGameScoreText.destroy();
+ miniGameScoreText = null;
}
- return null;
-}
-// Helper: check board full
-function sosBoardFull(board) {
- for (var y = 0; y < 3; y++) for (var x = 0; x < 3; x++) {
- if (!board[y][x]) return false;
+ if (miniGameTimeText) {
+ miniGameTimeText.destroy();
+ miniGameTimeText = null;
}
- return true;
-}
-// Helper: AI move (girl picks random empty, random S/O)
-function sosGirlMove() {
- var empties = [];
- for (var y = 0; y < 3; y++) for (var x = 0; x < 3; x++) {
- if (!sosBoard[y][x]) empties.push({
- x: x,
- y: y
- });
+ if (miniGameTimer) {
+ LK.clearInterval(miniGameTimer);
+ miniGameTimer = null;
}
- if (empties.length === 0) return;
- var pick = empties[Math.floor(Math.random() * empties.length)];
- var letter = Math.random() < 0.5 ? 'S' : 'O';
- sosPlaceTile(pick.x, pick.y, letter, 2);
-}
-// Place tile
-function sosPlaceTile(x, y, letter, player) {
- if (sosBoard[y][x] || sosGameOver) return;
- sosBoard[y][x] = {
- letter: letter,
- player: player
- };
- var tile = sosTiles[y][x];
- tile.letter.setText(letter);
- tile.letter.alpha = 1;
- tile.bg.color = player === 1 ? 0x83de44 : 0xd83318;
- // Animate
- tween(tile.letter, {
- scaleX: 1.2,
- scaleY: 1.2
- }, {
- duration: 120,
- onFinish: function onFinish() {
- tween(tile.letter, {
- scaleX: 1,
- scaleY: 1
- }, {
- duration: 120
- });
- }
+ // Remove handlers
+ game.move = null;
+ game.down = null;
+ game.update = null;
+ // Show result message
+ var resultText = new Text2(won ? "You did it!" : "Try again!", {
+ size: 180,
+ fill: won ? 0x83de44 : 0xff3b3b,
+ font: "'GillSans-Bold','Arial Black Bold',Impact,'Arial Black',Tahoma"
});
- // Check win
- var win = checkSOSWin(sosBoard);
- if (win) {
- sosGameOver = true;
- for (var i = 0; i < 3; i++) {
- var p = win.line[i];
- sosTiles[p.y][p.x].bg.color = 0xFFD700;
+ resultText.anchor.set(0.5, 0.5);
+ resultText.x = 2048 / 2;
+ resultText.y = 2732 / 2;
+ game.addChild(resultText);
+ // Show girl face
+ var resultGirl = LK.getAsset(won ? 'happyWoman' : 'angryWoman', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 2048 / 2,
+ y: 2732 / 2 - 400
+ });
+ game.addChild(resultGirl);
+ // After 1.5s, continue (if win: What/win screen, if lose: restart mini game)
+ LK.setTimeout(function () {
+ resultText.destroy();
+ resultGirl.destroy();
+ if (won) {
+ // Continue to What/win screen
+ showWhatWinScreen();
+ } else {
+ // Restart mini game
+ startMiniGame();
}
- sosStatusText.setText(player === 1 ? "You win!" : "Girl wins!");
- LK.setTimeout(function () {
- endSOSGame(player === 1);
- }, 1200);
- return;
- }
- if (sosBoardFull(sosBoard)) {
- sosGameOver = true;
- sosStatusText.setText("Draw!");
- LK.setTimeout(function () {
- endSOSGame(false);
- }, 1200);
- return;
- }
- // Next turn
- sosCurrentPlayer = 3 - player;
- if (sosCurrentPlayer === 2) {
- sosStatusText.setText("Girl's turn...");
- LK.setTimeout(function () {
- sosGirlMove();
- sosStatusText.setText("Your turn!");
- }, 700);
- } else {
- sosStatusText.setText("Your turn!");
- }
+ }, 1500);
}
-// End SOS game, continue to What/win screen if player won
-function endSOSGame(playerWon) {
- if (sosGameContainer) {
- sosGameContainer.visible = false;
- sosGameContainer.destroy();
- sosGameContainer = null;
- }
- if (playerWon) {
- // Continue to What/win screen
- showWhatAndWinScreen();
- } else {
- // Show game over
- LK.effects.flashScreen(0xff0000, 1000);
- LK.setTimeout(function () {
- LK.showGameOver();
- }, 1000);
- }
-}
-// Show What/win screen (moved from showSurprised)
-function showWhatAndWinScreen() {
- // Remove mouth if present and parent is not undefined/null
- if (woman.mouth && typeof woman.mouth.parent !== "undefined" && woman.mouth.parent !== null) {
- if (typeof woman.mouth.parent.removeChild === "function") {
- woman.mouth.parent.removeChild(woman.mouth);
- }
- }
+// Helper to show What/win screen (original showSurprised logic)
+function showWhatWinScreen() {
// Show only surprisedWoman face
woman.setState('surprised');
// Calculate final score
var heartPoints = hearts * 100;
@@ -838,10 +872,14 @@
scoreText.x = womanCenterX;
scoreText.y = womanCenterY + 600 + 300 + 300 + 247;
game.addChild(scoreText);
LK.setTimeout(function () {
- if (whatAsset && typeof whatAsset.destroy === "function") whatAsset.destroy();
- if (scoreText && typeof scoreText.destroy === "function") scoreText.destroy();
+ if (whatAsset && typeof whatAsset.destroy === "function") {
+ whatAsset.destroy();
+ }
+ if (scoreText && typeof scoreText.destroy === "function") {
+ scoreText.destroy();
+ }
}, 3000);
LK.setTimeout(function () {
if (woman.mouth && typeof woman.mouth.parent !== "undefined" && woman.mouth.parent !== null) {
if (typeof woman.mouth.parent.removeChild === "function") {
@@ -863,25 +901,33 @@
youWinScoreText.anchor.set(0.5, 1);
youWinScoreText.x = womanCenterX;
youWinScoreText.y = 2732 - 100;
game.addChild(youWinScoreText);
- if (woman.face) woman.face.destroy();
+ if (woman.face) {
+ woman.face.destroy();
+ }
woman.face = woman.attachAsset('youwinWoman', {
anchorX: 0.5,
anchorY: 0.5,
y: -100
});
}, 3000);
- for (var i = 0; i < 3; i++) answerButtons[i].visible = false;
- for (var i = 0; i < heartIcons.length; i++) heartIcons[i].visible = false;
+ for (var i = 0; i < 3; i++) {
+ answerButtons[i].visible = false;
+ }
+ for (var i = 0; i < heartIcons.length; i++) {
+ heartIcons[i].visible = false;
+ }
questionText.setText("");
LK.setTimeout(function () {
if (woman.mouth && typeof woman.mouth.parent !== "undefined" && woman.mouth.parent !== null) {
if (typeof woman.mouth.parent.removeChild === "function") {
woman.mouth.parent.removeChild(woman.mouth);
}
}
- if (woman.face) woman.face.destroy();
+ if (woman.face) {
+ woman.face.destroy();
+ }
woman.face = woman.attachAsset('youwinWoman', {
anchorX: 0.5,
anchorY: 0.5,
y: -100
@@ -890,160 +936,21 @@
LK.showYouWin();
}, 5000);
}, 3000);
}
-// Show SOS minigame
-function showSOSGame() {
- sosGameActive = true;
- sosGameOver = false;
- // Hide main game UI
- woman.visible = false;
- questionText.visible = false;
- for (var i = 0; i < answerButtons.length; i++) answerButtons[i].visible = false;
- for (var i = 0; i < heartIcons.length; i++) heartIcons[i].visible = false;
- // Create SOS game container
- sosGameContainer = new Container();
- game.addChild(sosGameContainer);
- // Add girl asset
- sosGirlAsset = LK.getAsset('happyWoman', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: womanCenterX,
- y: sosGirlY - 400,
- scaleX: 0.7,
- scaleY: 0.7
- });
- sosGameContainer.addChild(sosGirlAsset);
- // Add "SOS" title
- var sosTitle = new Text2('SOS', {
- size: 180,
- fill: 0xFFD700,
- font: "'GillSans-Bold','Arial Black Bold',Impact,'Arial Black',Tahoma"
- });
- sosTitle.anchor.set(0.5, 0.5);
- sosTitle.x = womanCenterX;
- sosTitle.y = sosGirlY - 200;
- sosGameContainer.addChild(sosTitle);
- // Add status text
- sosStatusText = new Text2("Your turn!", {
- size: 90,
- fill: 0xffffff,
- font: "'GillSans-Bold','Arial Black Bold',Impact,'Arial Black',Tahoma"
- });
- sosStatusText.anchor.set(0.5, 0.5);
- sosStatusText.x = womanCenterX;
- sosStatusText.y = sosGirlY + 320;
- sosGameContainer.addChild(sosStatusText);
- // Init board
- sosBoard = [];
- sosTiles = [];
- for (var y = 0; y < sosBoardSize; y++) {
- sosBoard[y] = [];
- sosTiles[y] = [];
- for (var x = 0; x < sosBoardSize; x++) {
- var tile = new Container();
- var bg = tile.attachAsset('box', {
- width: sosTileSize,
- height: sosTileSize,
- color: 0x222222,
- anchorX: 0.5,
- anchorY: 0.5
- });
- tile.bg = bg;
- tile.x = womanCenterX + (x - 1) * (sosTileSize + 30);
- tile.y = sosGirlY + (y - 1) * (sosTileSize + 30);
- // Letter text
- var letter = new Text2('', {
- size: 160,
- fill: 0xffffff
- });
- letter.anchor.set(0.5, 0.5);
- letter.x = 0;
- letter.y = 0;
- letter.alpha = 0.7;
- tile.letter = letter;
- tile.addChild(letter);
- // Touch handler
- (function (xx, yy) {
- tile.down = function (xp, yp, obj) {
- if (sosGameOver || sosBoard[yy][xx]) return;
- // Show letter picker
- showSOSLetterPicker(xx, yy);
- };
- })(x, y);
- sosGameContainer.addChild(tile);
- sosTiles[y][x] = tile;
- }
- }
- sosCurrentPlayer = 1;
- sosStatusText.setText("Your turn!");
-}
-// Show letter picker for SOS
-function showSOSLetterPicker(x, y) {
- // Only allow if empty and player's turn
- if (sosBoard[y][x] || sosCurrentPlayer !== 1 || sosGameOver) return;
- // Overlay picker
- var picker = new Container();
- picker.x = sosTiles[y][x].x;
- picker.y = sosTiles[y][x].y;
- // S button
- var sBtn = new Container();
- var sBg = sBtn.attachAsset('box', {
- width: sosTileSize / 2 - 10,
- height: sosTileSize - 20,
- color: 0x83de44,
- anchorX: 0.5,
- anchorY: 0.5
- });
- var sTxt = new Text2('S', {
- size: 120,
- fill: 0x000000
- });
- sTxt.anchor.set(0.5, 0.5);
- sBtn.addChild(sTxt);
- sBtn.x = -sosTileSize / 4;
- sBtn.y = 0;
- sBtn.down = function () {
- sosGameContainer.removeChild(picker);
- sosPlaceTile(x, y, 'S', 1);
- };
- // O button
- var oBtn = new Container();
- var oBg = oBtn.attachAsset('box', {
- width: sosTileSize / 2 - 10,
- height: sosTileSize - 20,
- color: 0xFFD700,
- anchorX: 0.5,
- anchorY: 0.5
- });
- var oTxt = new Text2('O', {
- size: 120,
- fill: 0x000000
- });
- oTxt.anchor.set(0.5, 0.5);
- oBtn.addChild(oTxt);
- oBtn.x = sosTileSize / 4;
- oBtn.y = 0;
- oBtn.down = function () {
- sosGameContainer.removeChild(picker);
- sosPlaceTile(x, y, 'O', 1);
- };
- picker.addChild(sBtn);
- picker.addChild(oBtn);
- sosGameContainer.addChild(picker);
-}
-// --- REPLACE showSurprised to show SOS game ---
+// Overwrite showSurprised to launch mini game
function showSurprised() {
if (surprisedShown) return;
surprisedShown = true;
gameEnded = true;
- // Hide main game UI
- woman.visible = false;
- questionText.visible = false;
- for (var i = 0; i < answerButtons.length; i++) answerButtons[i].visible = false;
- for (var i = 0; i < heartIcons.length; i++) heartIcons[i].visible = false;
- // Show SOS minigame
- showSOSGame();
+ // Remove mouth if present and parent is not undefined/null
+ if (woman.mouth && typeof woman.mouth.parent !== "undefined" && woman.mouth.parent !== null) {
+ if (typeof woman.mouth.parent.removeChild === "function") {
+ woman.mouth.parent.removeChild(woman.mouth);
+ }
+ }
+ // Start the mini game!
+ startMiniGame();
}
// Timer countdown function
function updateTimer() {
if (gameEnded || showingStartScreen) {
Delete the mouth. Woman have no mouth. Just same skin color.
An anime womans mouth. Just mouth.. In-Game asset. 2d. High contrast. No shadows
Fill it red. Its a red rectangle. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Delete the mouth. Woman have no mouth. Just same skin color.
Make her shy and seksier
Show her from a little further away and make a victory sign with her hand and smiley face
same photo but make a victory sign with her hand and smile
Same style bu write: DON'T YOU KNOW WHO YOU ARE
Write "TAP TO START" with a comic font. In-Game asset. 2d. High contrast. No shadows
Write comics style What? in golden color. In-Game asset. 2d. High contrast. No shadows
make same heath like a woman
delete blacks