User prompt
Do not show mainmenutitle asset when cards are loaded to the map
User prompt
Move mainmenutitle asset down by 77 units
User prompt
Replace st.patrick day match game title to mainmenutitle asset
User prompt
Move select game text up by 77 units
User prompt
Move select game text to the bottom of the screen
User prompt
Remove fourLeafClover asset attachment in Clover class when isFourLeaf is true to prevent duplicate assets
User prompt
Remove fourLeafClover asset under fourLeafClover4 asset when you loading it into the map
User prompt
U are loaded fourLeafClover asset and fourLeafClover4 asset at the same time. Load fourLeafClover4 asset without fourLeafClover asset at once
User prompt
Every second loaded fourLeafClover should be the fourLeafClover asset instead of fourLeafClover4 asset.
User prompt
You should load clovers countinously without piece limit. Every 7. Piece of clover should be the fourLeafClover4 or fourLeafClover assets
User prompt
You should load also the fourLeafClover4 and fourLeafClover asset as 4leafclover container in the finder mode
User prompt
Add fourLeafClover4 to loading 4leafclover container in the finder (clover hunt) mode
User prompt
Move time counter under the coin counter text and fit to center
User prompt
Move time counter from the right side of the screen to the left side of the screen
User prompt
Change coins caught counter size to the same as time counter. This game mode is not over when the player collected 50 piece of coins but finish when the time counter is reach zero.
User prompt
Change time counter color to the same golden yellow as the coin counter
User prompt
Add a white colored little Time counter to the top right corner of the coin cather game mode. Count down from 1 minute. When counter is reach zero then write out the score, but not the game over.
User prompt
Move 4 leaf clover counter up by 123 units and right by 333 units
User prompt
Move three leaf clover counter up by 123 units
User prompt
Move three leaf clover counter up by 100 units
User prompt
Please fix the bug: 'Uncaught ReferenceError: finderThreeLeafCount is not defined' in or related to this line: 'finderThreeLeafCount++;' Line Number: 187
User prompt
Add three leaf counter to the top of the screen in the finder game mode
User prompt
Move up coins caught counter by 123 unit
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
bestScore: 0,
level: 1
});
/****
* Classes
****/
var Card = Container.expand(function (cardId, pairId) {
var self = Container.call(this);
self.cardId = cardId;
self.pairId = pairId;
self.isFlipped = false;
self.isMatched = false;
// Card back (shown when not flipped)
var cardBack = self.attachAsset('cardBack', {
anchorX: 0.5,
anchorY: 0.5
});
// Card front (the actual pattern/color)
var cardFront = self.attachAsset('pair' + pairId, {
anchorX: 0.5,
anchorY: 0.5,
visible: false
});
if (pairId === 'J') {
cardFront = self.attachAsset('pairJ', {
anchorX: 0.5,
anchorY: 0.5,
visible: false
});
}
if (pairId === 'K') {
cardFront = self.attachAsset('pairK', {
anchorX: 0.5,
anchorY: 0.5,
visible: false
});
}
if (pairId === 'L') {
cardFront = self.attachAsset('pairL', {
anchorX: 0.5,
anchorY: 0.5,
visible: false
});
}
self.back = cardBack;
self.front = cardFront;
// Method to flip the card
self.flip = function () {
if (self.isMatched || self.isFlipped) {
return false;
}
LK.getSound('flip').play();
self.isFlipped = true;
// Animate the flip
tween(cardBack, {
scaleX: 0
}, {
duration: 150,
easing: tween.easeIn,
onFinish: function onFinish() {
cardBack.visible = false;
cardFront.visible = true;
tween(cardFront, {
scaleX: 1
}, {
duration: 150,
easing: tween.easeOut
});
}
});
return true;
};
// Method to flip back
self.flipBack = function () {
if (self.isMatched || !self.isFlipped) {
return;
}
self.isFlipped = false;
tween(cardFront, {
scaleX: 0
}, {
duration: 150,
easing: tween.easeIn,
onFinish: function onFinish() {
cardFront.visible = false;
cardBack.visible = true;
tween(cardBack, {
scaleX: 1
}, {
duration: 150,
easing: tween.easeOut
});
}
});
};
// Method to mark card as matched
self.setMatched = function () {
self.isMatched = true;
// Create a matched effect
var matchEffect = self.attachAsset('cardMatch', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0
});
tween(matchEffect, {
alpha: 0.7
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
matchEffect.destroy(); // Remove the matched effect after animation
self.removeChild(matchEffect); // Ensure the effect is removed from the display list
}
});
};
// Handle card selection
self.down = function (x, y, obj) {
if (!gameActive || processingMatch || self.isMatched) {
return;
}
var flipped = self.flip();
if (flipped) {
checkForMatch(self);
}
};
return self;
});
var Clover = Container.expand(function (isFourLeaf) {
var self = Container.call(this);
self.isFourLeaf = isFourLeaf;
var cloverAsset = self.attachAsset(isFourLeaf ? 'fourLeafClover' : 'threeLeafClover', {
anchorX: 0.5,
anchorY: 0.5
});
self.down = function (x, y, obj) {
if (!finderGameActive) {
return;
}
if (self.isFourLeaf) {
finderScore++;
finderCounterText.setText('Found: ' + finderScore);
LK.getSound('match').play();
// Remove the four leaf clover after found
self.destroy();
} else {
finderThreeLeafCount++;
finderThreeLeafCounterText.setText('Three Leaf: ' + finderThreeLeafCount);
LK.getSound('flip').play();
// Remove the three leaf clover after found
self.destroy();
}
};
return self;
});
var Coin = Container.expand(function () {
var self = Container.call(this);
self.speed = 5;
self.lastY = 0;
var coinGraphics = self.attachAsset('coin', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
self.lastY = self.y;
self.y += self.speed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 // Updated to use the latest LK engine default background color
});
/****
* Game Code
****/
// Game state variables
var cards = [];
var gridWidth = 4;
var gridHeight = 3;
var cardWidth = 180;
var cardHeight = 250;
var cardSpacing = 200; // Increased vertical spacing between cards
var flippedCards = [];
var gameActive = false;
var processingMatch = false;
var moves = 0;
var pairsFound = 0;
var level = 1;
var totalPairs = gridWidth * gridHeight / 2;
var gameStartTime;
// UI Elements
var titleText = new Text2("St. Patrick's Day Match Game", {
size: 80,
fill: 0xFFA500,
fontWeight: 'bolder'
});
titleText.anchor.set(0.5, 0);
LK.gui.top.addChild(titleText);
titleText.y = 50;
var movesText = new Text2('Moves: 0', {
size: 60,
fill: 0xFFFFFF
});
movesText.anchor.set(0, 0);
LK.gui.topLeft.addChild(movesText);
movesText.x = 120;
movesText.y = 150;
movesText.visible = false;
var levelText = new Text2('Level: ' + level, {
size: 60,
fill: 0xFFFFFF
});
levelText.anchor.set(1, 0);
LK.gui.topRight.addChild(levelText);
levelText.x = -120;
levelText.y = 150;
levelText.visible = false;
var timerText = new Text2('Time: 0s', {
size: 60,
fill: 0xFFFFFF
});
timerText.anchor.set(0.5, 0);
LK.gui.top.addChild(timerText);
timerText.y = 150;
timerText.visible = false;
// Mode Selector Menu
var modeMenu = new Container();
var mwBackground = modeMenu.attachAsset('MW', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2,
scaleX: 2048 / 2040,
scaleY: 2732 / 2800
});
game.addChild(modeMenu);
// Game selector title
var modeTitle = new Text2("Select Game", {
size: 80,
fill: 0xFFA500,
fontWeight: 'bolder'
});
modeTitle.anchor.set(0.5, 0);
modeMenu.addChild(modeTitle);
modeTitle.x = 2048 / 2;
modeTitle.y = 300;
// Game selector buttons
var games = ['Memory Card Game', 'Clicker', 'Finder'];
var modeButtons = [];
var modeButtonY = 2732 / 2 - 300;
var modeButtonVerticalSpacing = 350;
var modeStartX = 2048 / 2;
var selectedMode = 'Memory Card Game';
var finderGameActive = false;
var finderScore = 0;
var finderCounterText;
var finderThreeLeafCount = 0;
var finderThreeLeafCounterText;
var finderSpawnInterval;
var finderCloversSpawned = 0;
var finderTotalCloversToSpawn = 30;
for (var modeIdx = 0; modeIdx < games.length; modeIdx++) {
var modeName = games[modeIdx];
var modeBtn = new Container();
var modeBtnBg;
if (modeName === 'Memory Card Game') {
modeBtnBg = modeBtn.attachAsset('MCGB', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.6,
scaleY: 0.6
});
} else if (modeName === 'Memory Card Game') {
// Already handled above
} else if (modeName === 'Clicker') {
modeBtnBg = modeBtn.attachAsset('CCB', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1,
scaleY: 1
});
} else {
modeBtnBg = modeBtn.attachAsset('CHB', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.9,
scaleY: 0.75
});
}
if (modeName !== 'Memory Card Game' && modeName !== 'Clicker' && modeName !== 'Finder') {
var modeBtnText = new Text2(modeName, {
size: 50,
fill: 0xFFFFFF
});
modeBtnText.anchor.set(0.5, 0.5);
modeBtnText.x = 0;
modeBtnText.y = 0;
modeBtn.addChild(modeBtnText);
}
modeBtn.modeName = modeName;
modeBtn.x = modeStartX;
modeBtn.y = modeButtonY + modeIdx * modeButtonVerticalSpacing;
modeMenu.addChild(modeBtn);
modeButtons.push(modeBtn);
modeBtn.down = function (btnMode) {
return function (x, y, obj) {
selectedMode = btnMode;
// Update visual feedback for selected mode
for (var updateModeBtn = 0; updateModeBtn < modeButtons.length; updateModeBtn++) {
var modeBtnBgChild = modeButtons[updateModeBtn].children[0];
if (modeButtons[updateModeBtn].modeName === btnMode) {
tween(modeBtnBgChild, {
tint: 0xFFCC00
}, {
duration: 300,
easing: tween.easeOut
});
} else {
tween(modeBtnBgChild, {
tint: 0xFFFFFF
}, {
duration: 300,
easing: tween.easeOut
});
}
}
};
}(modeName);
}
// Confirm mode button
var confirmModeBtn = new Container();
var confirmModeBtnBg = confirmModeBtn.attachAsset('startButton', {
anchorX: 0.5,
anchorY: 0.5
});
var confirmModeBtnText = new Text2('Confirm', {
size: 60,
fill: 0xFFFFFF
});
confirmModeBtnText.anchor.set(0.5, 0.5);
confirmModeBtn.addChild(confirmModeBtnText);
confirmModeBtn.x = 2048 / 2;
confirmModeBtn.y = modeButtonY + (games.length - 1) * modeButtonVerticalSpacing + 200 + 123;
modeMenu.addChild(confirmModeBtn);
confirmModeBtn.down = function (x, y, obj) {
// Remove Mode Menu
game.removeChild(modeMenu);
// If Finder mode is selected, start Finder game directly
if (selectedMode === 'Finder') {
initializeFinderGame();
} else if (selectedMode === 'Clicker') {
// Clicker mode starts directly without level selector
initializeClickerGame();
} else {
// Otherwise show Card Game Menu for level selection
game.addChild(cardGameMenu);
}
};
// Card Game Menu
var cardGameMenu = new Container();
var mwBackgroundCardGame = cardGameMenu.attachAsset('MW', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2,
scaleX: 2048 / 2040,
scaleY: 2732 / 2800
});
// Do not add to game yet - will be added after mode selection
// Level selector buttons
var levelButtons = [];
var levelButtonY = 2732 / 2 - 250;
var buttonSpacing = 337.5;
var centerButtonIndex = 2; // Level 3 is at index 2 (0-indexed)
var totalButtons = 5;
var totalButtonWidth = totalButtons * 270 + (totalButtons - 1) * buttonSpacing; // 270 is approximate button width after scaling
var startX = 2048 / 2 - totalButtonWidth / 2 + 700 - 25;
for (var levelNum = 1; levelNum <= 5; levelNum++) {
var levelBtn = new Container();
var levelBtnBg = levelBtn.attachAsset('cardMatch', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.9,
scaleY: 0.75
});
var levelBtnText = new Text2('Level ' + levelNum, {
size: 50,
fill: 0xFFFFFF
});
levelBtnText.anchor.set(0.5, 0.5);
levelBtnText.x = 0;
levelBtnText.y = 0;
levelBtn.addChild(levelBtnText);
levelBtn.levelNum = levelNum;
levelBtn.x = startX + (levelNum - 1) * buttonSpacing;
levelBtn.y = levelButtonY;
cardGameMenu.addChild(levelBtn);
levelButtons.push(levelBtn);
levelBtn.down = function (btnLevel) {
return function (x, y, obj) {
level = btnLevel;
// Update visual feedback for selected level
for (var updateBtn = 0; updateBtn < levelButtons.length; updateBtn++) {
var btnBg = levelButtons[updateBtn].children[0];
if (levelButtons[updateBtn].levelNum === btnLevel) {
tween(btnBg, {
tint: 0xFFCC00
}, {
duration: 300,
easing: tween.easeOut
});
} else {
tween(btnBg, {
tint: 0xFFFFFF
}, {
duration: 300,
easing: tween.easeOut
});
}
}
};
}(levelNum);
}
// Add cardGameMenu to game after mode selection confirmation
var startBtn = new Container();
var startBtnBg = startBtn.attachAsset('startButton', {
anchorX: 0.5,
anchorY: 0.5
});
var startBtnText = new Text2('Start Game', {
size: 60,
fill: 0xFFFFFF
});
startBtnText.anchor.set(0.5, 0.5);
startBtn.addChild(startBtnText);
startBtn.x = 2048 / 2;
startBtn.y = 2732 / 2 + 150;
cardGameMenu.addChild(startBtn);
// Timer update
var timerInterval;
function startTimer() {
gameStartTime = Date.now();
timerInterval = LK.setInterval(function () {
var elapsed = Math.floor((Date.now() - gameStartTime) / 1000);
timerText.setText('Time: ' + elapsed + 's');
}, 1000);
}
// Initialize the Clicker game
function initializeClickerGame() {
// Hide title text for Clicker game
titleText.visible = false;
// Add CCW background
var grassBg = game.addChild(LK.getAsset('CCW', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0,
scaleX: 2048 / 2040,
scaleY: 2732 / 3000
}));
// Initialize clicker game state
var coins = [];
var clickerScore = 0;
var potX = 2048 / 2;
var potY = 2600;
var potWidth = 250;
var potHeight = 200;
var coinSpawnRate = 500;
var clickerGameActive = true;
// Create pot at bottom of screen
var pot = game.addChild(LK.getAsset('pot', {
anchorX: 0.5,
anchorY: 0.5,
x: potX,
y: potY
}));
// Create score display
var clickerScoreText = new Text2('Coins Caught: 0', {
size: 80,
fill: 0xFFD700
});
clickerScoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(clickerScoreText);
clickerScoreText.y = 150 - 123;
// Handle pot movement
game.move = function (x, y, obj) {
pot.x = x;
};
// Spawn coins at regular intervals
var coinSpawnInterval = LK.setInterval(function () {
if (!clickerGameActive || coins.length > 50) {
return;
}
var newCoin = new Coin();
var randomX = Math.random() * 2048;
newCoin.x = randomX;
newCoin.y = -50;
newCoin.lastY = newCoin.y;
coins.push(newCoin);
game.addChild(newCoin);
}, coinSpawnRate);
// Update game state
var originalUpdate = game.update;
game.update = function () {
for (var i = coins.length - 1; i >= 0; i--) {
var coin = coins[i];
if (coin.lastY === undefined) coin.lastY = coin.y;
// Check if coin fell off screen
if (coin.lastY >= -50 && coin.y > 2732) {
coin.destroy();
coins.splice(i, 1);
continue;
}
// Check collision with pot
if (coin.intersects(pot)) {
clickerScore++;
clickerScoreText.setText('Coins Caught: ' + clickerScore);
LK.getSound('match').play();
coin.destroy();
coins.splice(i, 1);
// Check win condition (50 coins caught)
if (clickerScore >= 50) {
clickerGameActive = false;
LK.clearInterval(coinSpawnInterval);
LK.setScore(clickerScore * 10);
LK.setTimeout(function () {
LK.showYouWin();
}, 500);
}
continue;
}
coin.lastY = coin.y;
}
};
// Play background music
LK.playMusic('bgmusic');
}
// Initialize the Finder game
function initializeFinderGame() {
// Hide title text for Finder game
titleText.visible = false;
// Add grass background
var grassBg = game.addChild(LK.getAsset('grassBackground', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
}));
// Clear any existing clovers
for (var i = game.children.length - 1; i >= 0; i--) {
var child = game.children[i];
if (child instanceof Clover) {
child.destroy();
}
}
finderGameActive = true;
finderScore = 0;
finderCloversSpawned = 0;
// Create counter text for four leaf clovers found
finderCounterText = new Text2('Found: 0', {
size: 60,
fill: 0xFFFFFF
});
finderCounterText.anchor.set(0.5, 0);
LK.gui.top.addChild(finderCounterText);
finderCounterText.y = 150;
// Create counter text for three leaf clovers found
finderThreeLeafCounterText = new Text2('Three Leaf: 0', {
size: 60,
fill: 0x90EE90
});
finderThreeLeafCounterText.anchor.set(0.5, 0);
LK.gui.top.addChild(finderThreeLeafCounterText);
finderThreeLeafCounterText.y = 150 - 123;
// Reset three leaf clover count
finderThreeLeafCount = 0;
// Determine which clover will be the four-leaf one
var fourLeafIndex = Math.floor(Math.random() * finderTotalCloversToSpawn);
// Start spawning clovers at random positions every second
finderSpawnInterval = LK.setInterval(function () {
if (!finderGameActive || finderCloversSpawned >= finderTotalCloversToSpawn) {
LK.clearInterval(finderSpawnInterval);
return;
}
var isFourLeaf = finderCloversSpawned === fourLeafIndex;
var clover = new Clover(isFourLeaf);
// Random position on screen (avoiding top area where UI is)
var randomX = Math.random() * (2048 - 200) + 100;
var randomY = Math.random() * (2732 - 600) + 300;
clover.x = randomX;
clover.y = randomY;
// Start with scale 0
clover.scaleX = 0;
clover.scaleY = 0;
game.addChild(clover);
// Animate scale to 1
tween(clover, {
scaleX: 1,
scaleY: 1
}, {
duration: 500,
easing: tween.easeOut
});
finderCloversSpawned++;
}, 1000);
// Play background music
LK.playMusic('bgmusic');
}
// Initialize the game board
function initializeBoard() {
// Show title text for Memory Card Game
titleText.visible = true;
// Add MW background for memory card game
var mwBackgroundBoard = game.addChild(LK.getAsset('MW', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2,
scaleX: 2048 / 2040 * 1.4,
scaleY: 2732 / 2800 * 1.4
}));
// Clear existing cards
for (var i = 0; i < cards.length; i++) {
cards[i].destroy();
}
cards = [];
flippedCards = [];
pairsFound = 0;
moves = 0;
processingMatch = false;
gameActive = true;
movesText.setText('Moves: 0');
// Update level text display
levelText.setText('Level: ' + level);
// Show HUD elements when game starts
movesText.visible = true;
levelText.visible = true;
timerText.visible = true;
// Set level-based grid size
if (level === 1) {
gridWidth = 3;
gridHeight = 3;
} else if (level === 2) {
gridWidth = 3;
gridHeight = 4;
} else if (level === 3) {
gridWidth = 4;
gridHeight = 4;
} else if (level === 4) {
gridWidth = 4;
gridHeight = 5;
} else if (level >= 5) {
gridWidth = 5;
gridHeight = 5;
}
// Calculate total cards accounting for skipped center card on level 1 and level 5
var totalCards = gridWidth * gridHeight;
if (level === 1 || level === 5) {
totalCards = totalCards - 1;
}
totalPairs = totalCards / 2;
// Create cards and assign pairs
var pairIds = [];
if (level >= 5) {
// Level 5: Create 12 pairs (A-L) each appearing exactly twice to fill 24 cards
// 12 pairs ร 2 = 24 cards with perfect pairing
for (var p = 0; p < 12; p++) {
var pairLetter = String.fromCharCode(65 + p);
pairIds.push(pairLetter);
pairIds.push(pairLetter);
}
} else {
// Levels 1-4: Create exact pairs needed without repetition
for (var p = 0; p < totalPairs; p++) {
var pairLetter = String.fromCharCode(65 + p);
pairIds.push(pairLetter);
pairIds.push(pairLetter);
}
}
// Shuffle pairs
for (var s = pairIds.length - 1; s > 0; s--) {
var j = Math.floor(Math.random() * (s + 1));
var temp = pairIds[s];
pairIds[s] = pairIds[j];
pairIds[j] = temp;
}
// Determine the grid layout positioning
var gridTotalWidth = gridWidth * cardWidth + (gridWidth - 1) * cardSpacing;
var gridTotalHeight = gridHeight * cardHeight + (gridHeight - 1) * cardSpacing;
var startX = (2048 - gridTotalWidth) / 2;
var startY = (2732 - gridTotalHeight) / 2 + (level >= 5 ? 100 : 0);
// Move level 4 cards down by 123 units
if (level === 4) {
startY += 123;
}
// Create and position the cards
var cardIndex = 0;
for (var row = 0; row < gridHeight; row++) {
for (var col = 0; col < gridWidth; col++) {
// Skip center card for level 1 and level 5
if (level === 1 && row === 1 && col === 1 || level === 5 && row === 2 && col === 2) {
continue;
}
var x = startX + col * (cardWidth + cardSpacing) + cardWidth / 2;
var y = startY + row * (cardHeight + cardSpacing) + cardHeight / 2;
var card = new Card(cardIndex, pairIds[cardIndex]);
card.x = x;
card.y = y;
cards.push(card);
game.addChild(card);
cardIndex++;
}
}
// Start the timer
startTimer();
// Play background music
LK.playMusic('bgmusic');
}
// Check for matching cards
function checkForMatch(card) {
flippedCards.push(card);
if (flippedCards.length === 2) {
processingMatch = true;
moves++;
movesText.setText('Moves: ' + moves);
var card1 = flippedCards[0];
var card2 = flippedCards[1];
if (card1.pairId === card2.pairId) {
// Match found
LK.setTimeout(function () {
LK.getSound('match').play();
card1.setMatched();
card2.setMatched();
flippedCards = [];
processingMatch = false;
// Increment pairs found
pairsFound++;
// Check for win condition
if (pairsFound === totalPairs) {
gameWon();
}
}, 500);
} else {
// No match
LK.setTimeout(function () {
LK.getSound('nomatch').play();
card1.flipBack();
card2.flipBack();
flippedCards = [];
processingMatch = false;
}, 1000);
}
}
}
// Handle game win
function gameWon() {
gameActive = false;
// Calculate score based on moves and time
var timeElapsed = Math.floor((Date.now() - gameStartTime) / 1000);
LK.clearInterval(timerInterval);
// Calculate score (fewer moves and less time = higher score)
var baseScore = 1000;
var movePenalty = moves * 10;
var timePenalty = timeElapsed * 2;
var score = Math.max(100, baseScore - movePenalty - timePenalty);
// Update best score
if (score > storage.bestScore) {
storage.bestScore = score;
}
// Set the score
LK.setScore(score);
// Play win sound
LK.getSound('win').play();
// Show win message
LK.setTimeout(function () {
// Hide HUD elements
movesText.visible = false;
levelText.visible = false;
timerText.visible = false;
// Level up
level++;
storage.level = level;
// Show you win screen
LK.showYouWin();
// Load the next level after a short delay to ensure transition
LK.setTimeout(function () {
initializeBoard();
gameActive = true; // Reactivate the game
startTimer(); // Restart the timer for the new level
}, 2000); // Delay to allow the win screen to show
}, 1500);
}
// Start button interaction
startBtn.down = function (x, y, obj) {
// Remove Card Game Menu from display
game.removeChild(cardGameMenu);
// Initialize appropriate game based on selected mode
if (selectedMode === 'Memory Card Game') {
initializeBoard();
} else if (selectedMode === 'Finder') {
initializeFinderGame();
} else {
// Handle other game modes here in the future
console.log("Selected game: " + selectedMode);
}
};
// Handle game update
game.update = function () {
// Nothing needed here as the game logic is event-driven
}; ===================================================================
--- original.js
+++ change.js
@@ -580,9 +580,9 @@
fill: 0x90EE90
});
finderThreeLeafCounterText.anchor.set(0.5, 0);
LK.gui.top.addChild(finderThreeLeafCounterText);
- finderThreeLeafCounterText.y = 150;
+ finderThreeLeafCounterText.y = 150 - 123;
// Reset three leaf clover count
finderThreeLeafCount = 0;
// Determine which clover will be the four-leaf one
var fourLeafIndex = Math.floor(Math.random() * finderTotalCloversToSpawn);
yellow rectangle button
Golden shamrock pendant. High contrast
3 leaf clover in a white paper card with rounded corners, front view.
Lucky star in a white paper-card with rounded corners, front view.. In-Game asset. 2d. No shadows
Green Hearth in a white paper-card with rounded corners, front view.. In-Game asset. 2d. High contrast. No shadows
Green ribbon with shamrock in a white paper-card with rounded corners, front view..