/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Plant = Container.expand(function (type, x, y) { var self = Container.call(this); self.plantType = type || 'daisy'; self.stage = 'empty'; // empty, seed, sprout, flower self.lastWatered = 0; self.planted = false; self.waterNeed = self.plantType === 'daisy' ? 2 : 3; // days between watering var pot = self.attachAsset('pot', { anchorX: 0.5, anchorY: 1 }); self.plantGraphics = null; self.x = x; self.y = y; self.plant = function () { if (self.stage === 'empty') { self.stage = 'seed'; self.planted = true; self.lastWatered = currentDay; // Create green pixel that will grow over time self.plantGraphics = self.addChild(LK.getAsset('sprout', { anchorX: 0.5, anchorY: 1, scaleX: 0.1, scaleY: 0.1 })); self.plantGraphics.y = -5; self.plantGraphics.height = 2; // Start with 1 pixel height // Add visual planting effect var plantEffect = self.addChild(LK.getAsset('seed', { anchorX: 0.5, anchorY: 0.5, alpha: 1, scaleX: 2, scaleY: 2 })); plantEffect.y = -10; tween(plantEffect, { alpha: 0, scaleX: 0.5, scaleY: 0.5, y: -30 }, { duration: 800, onFinish: function onFinish() { plantEffect.destroy(); } }); LK.getSound('plant').play(); } }; self.water = function () { if (self.planted && currentDay - self.lastWatered >= 1) { self.lastWatered = currentDay; var waterEffect = self.addChild(LK.getAsset('water', { anchorX: 0.5, anchorY: 0.5, alpha: 0.7 })); waterEffect.y = -40; tween(waterEffect, { alpha: 0, y: -80 }, { duration: 1000, onFinish: function onFinish() { waterEffect.destroy(); } }); LK.getSound('water').play(); } }; self.harvest = function () { if (self.stage === 'flower') { if (self.plantGraphics) { self.plantGraphics.destroy(); self.plantGraphics = null; } self.stage = 'empty'; self.planted = false; LK.setScore(LK.getScore() + 10); updateScoreText(); LK.getSound('harvest').play(); return true; } return false; }; self.update = function () { if (!self.planted) return; var daysSinceWatered = currentDay - self.lastWatered; var daysSincePlanted = currentDay - self.lastWatered; // Green pixel growth - increases height each day if (self.plantGraphics && self.stage === 'seed') { var targetHeight = Math.min(2 + daysSincePlanted * 5, 30); // Grow 5 pixels per day, max 30 var targetScaleY = targetHeight / 30; // Scale based on target height // Smooth growth animation tween(self.plantGraphics, { scaleY: targetScaleY, y: -5 - targetHeight / 2 }, { duration: 500, easing: tween.easeOut }); } // Accelerated growth logic for immediate feedback if (self.stage === 'seed' && daysSinceWatered <= self.waterNeed && daysSincePlanted >= 3) { // Grow to sprout after 3 days self.stage = 'sprout'; if (self.plantGraphics) { self.plantGraphics.destroy(); } self.plantGraphics = self.addChild(LK.getAsset('sprout', { anchorX: 0.5, anchorY: 1 })); self.plantGraphics.y = -15; // Add growth animation tween(self.plantGraphics, { scaleX: 1, scaleY: 1 }, { duration: 1000, easing: tween.bounceOut }); } else if (self.stage === 'sprout' && daysSinceWatered <= self.waterNeed && daysSincePlanted >= 7) { // Grow to flower after 7 days self.stage = 'flower'; if (self.plantGraphics) { self.plantGraphics.destroy(); } var flowerAsset = self.plantType === 'daisy' ? 'daisyFlower' : 'geraniumFlower'; self.plantGraphics = self.addChild(LK.getAsset(flowerAsset, { anchorX: 0.5, anchorY: 1 })); self.plantGraphics.y = -25; // Add blooming animation self.plantGraphics.scaleX = 0.1; self.plantGraphics.scaleY = 0.1; tween(self.plantGraphics, { scaleX: 1, scaleY: 1 }, { duration: 1500, easing: tween.bounceOut }); } // Visual feedback for watering needs if (self.planted && daysSinceWatered > self.waterNeed) { pot.tint = 0xA0522D; // Darker brown when needs water } else { pot.tint = 0xCD853F; // Normal brown } }; self.down = function (x, y, obj) { if (selectedAction === 'plant') { if (self.stage === 'empty') { self.plant(); // Show planting confirmation text var plantText = self.addChild(new Text2('Planted!', { size: 30, fill: 0x228B22 })); plantText.anchor.set(0.5, 0.5); plantText.y = -60; tween(plantText, { alpha: 0, y: -100 }, { duration: 1500, onFinish: function onFinish() { plantText.destroy(); } }); } } else if (selectedAction === 'water') { self.water(); } else if (selectedAction === 'harvest') { self.harvest(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xFFE4B5 }); /**** * Game Code ****/ // Game state variables var currentDay = 0; var currentWeek = 1; var dayProgress = 0; var selectedAction = 'plant'; var plants = []; var tutorialStep = 0; var showingTutorial = true; var seedCursor = null; // Create background image var bgImage = game.addChild(LK.getAsset('bg', { anchorX: 0.5, anchorY: 0.5 })); bgImage.x = 2048 / 2; bgImage.y = 2732 / 2; bgImage.width = 2048; bgImage.height = 2732; // Create warm sunlight var sunlight = game.addChild(LK.getAsset('sunlight', { anchorX: 0.5, anchorY: 0.5 })); sunlight.x = 1700; sunlight.y = 1000; sunlight.alpha = 0.3; // Create balcony railing var railing = game.addChild(LK.getAsset('balconyRailing', { anchorX: 0.5, anchorY: 1 })); railing.x = 2048 / 2; railing.y = 2185; // Create balcony floor var balcony = game.addChild(LK.getAsset('balcony', { anchorX: 0.5, anchorY: 1 })); balcony.x = 2048 / 2; balcony.y = 2200; // Create plant pots for (var i = 0; i < 4; i++) { var plantX = 600 + i * 270; // Increased spacing from 250 to 270 (20px more) var plantY = 2170; // Moved down from 2150 to 2170 (20px down) var plant = new Plant('daisy', plantX, plantY); plants.push(plant); game.addChild(plant); } // UI Elements var scoreText = new Text2('Flowers: 0', { size: 60, fill: 0x4A4A4A }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); scoreText.y = 150; var dayText = new Text2('Day 1', { size: 50, fill: 0x4A4A4A }); dayText.anchor.set(1, 0); LK.gui.topRight.addChild(dayText); dayText.x = -50; dayText.y = 100; var weekText = new Text2('Week 1', { size: 50, fill: 0x4A4A4A }); weekText.anchor.set(1, 0); LK.gui.topRight.addChild(weekText); weekText.x = -50; weekText.y = 160; // Action buttons var plantButton = game.addChild(LK.getAsset('plantButton', { anchorX: 0.5, anchorY: 0.5 })); plantButton.x = 400; plantButton.y = 2500; var plantButtonText = new Text2('PLANT', { size: 40, fill: 0xFFFFFF }); plantButtonText.anchor.set(0.5, 0.5); plantButton.addChild(plantButtonText); var waterButton = game.addChild(LK.getAsset('waterButton', { anchorX: 0.5, anchorY: 0.5 })); waterButton.x = 1024; waterButton.y = 2500; var waterButtonText = new Text2('WATER', { size: 40, fill: 0xFFFFFF }); waterButtonText.anchor.set(0.5, 0.5); waterButton.addChild(waterButtonText); var harvestButton = game.addChild(LK.getAsset('harvestButton', { anchorX: 0.5, anchorY: 0.5 })); harvestButton.x = 1648; harvestButton.y = 2500; var harvestButtonText = new Text2('HARVEST', { size: 40, fill: 0xFFFFFF }); harvestButtonText.anchor.set(0.5, 0.5); harvestButton.addChild(harvestButtonText); // Tutorial text var tutorialText = new Text2('Welcome to your balcony garden!\nTap PLANT to start growing daisies.', { size: 45, fill: 0x2F4F2F }); tutorialText.anchor.set(0.5, 0.5); tutorialText.x = 1024; tutorialText.y = 1200; game.addChild(tutorialText); function updateScoreText() { scoreText.setText('Flowers: ' + LK.getScore()); } function updateDayText() { dayText.setText('Day ' + (currentDay + 1)); weekText.setText('Week ' + currentWeek); } function updateButtonSelection() { plantButton.tint = selectedAction === 'plant' ? 0xFFFFFF : 0xCCCCCC; waterButton.tint = selectedAction === 'water' ? 0xFFFFFF : 0xCCCCCC; harvestButton.tint = selectedAction === 'harvest' ? 0xFFFFFF : 0xCCCCCC; // Show/hide seed cursor based on selected action if (seedCursor) { seedCursor.alpha = selectedAction === 'plant' ? 0.8 : 0; } } function updateTutorial() { if (!showingTutorial) return; if (tutorialStep === 0) { tutorialText.setText('Welcome to your balcony garden!\nTap PLANT to start growing daisies.'); } else if (tutorialStep === 1) { tutorialText.setText('Great! Now tap on a pot to plant a daisy seed.'); } else if (tutorialStep === 2) { tutorialText.setText('Perfect! Your daisy will grow over time.\nRemember to water it every 2 days.'); } else if (tutorialStep === 3) { tutorialText.setText('Tap WATER, then tap your plant to water it.\nWatch it grow from seed to flower!'); showingTutorial = false; LK.setTimeout(function () { tutorialText.alpha = 0; }, 3000); } } // Button event handlers plantButton.down = function () { selectedAction = 'plant'; updateButtonSelection(); if (showingTutorial && tutorialStep === 0) { tutorialStep = 1; updateTutorial(); } }; waterButton.down = function () { selectedAction = 'water'; updateButtonSelection(); }; harvestButton.down = function () { selectedAction = 'harvest'; updateButtonSelection(); }; // Create seed cursor (initially hidden) seedCursor = game.addChild(LK.getAsset('seedCursor', { anchorX: 0.5, anchorY: 0.5, alpha: 0 })); // Mouse move handler for seed cursor game.move = function (x, y, obj) { if (selectedAction === 'plant' && seedCursor) { seedCursor.x = x; seedCursor.y = y; seedCursor.alpha = 0.8; } }; // Initialize updateButtonSelection(); updateScoreText(); updateDayText(); updateTutorial(); // Start ambient music LK.playMusic('ambient'); // Day progression timer var dayTimer = LK.setInterval(function () { dayProgress += 1; // Day-night cycle visual effect var timeOfDay = dayProgress % 240 / 240; // 4 second day cycle var brightness = 0.4 + 0.6 * Math.abs(Math.sin(timeOfDay * Math.PI)); var baseColor = 0xFFE4B5; // Warm peachy background var r = (baseColor >> 16 & 0xFF) * brightness; var g = (baseColor >> 8 & 0xFF) * brightness; var b = (baseColor & 0xFF) * brightness; var nightColor = r << 16 | g << 8 | b; game.setBackgroundColor(nightColor); // Update sunlight opacity for day/night sunlight.alpha = 0.1 + 0.4 * Math.abs(Math.sin(timeOfDay * Math.PI)); // Advance day every 10 seconds if (dayProgress % 600 === 0) { currentDay++; if (currentDay % 7 === 0) { currentWeek++; // Week 2: Add geraniums if (currentWeek === 2) { for (var i = 0; i < 2; i++) { var plantX = 1800 + i * 220; // Increased spacing from 200 to 220 (20px more) var plantY = 2170; // Moved down from 2150 to 2170 (20px down) var geranium = new Plant('geranium', plantX, plantY); plants.push(geranium); game.addChild(geranium); } } } updateDayText(); } }, 100); game.update = function () { // Update all plants for (var i = 0; i < plants.length; i++) { plants[i].update(); } // Check for tutorial progression if (showingTutorial && tutorialStep === 1) { for (var j = 0; j < plants.length; j++) { if (plants[j].planted) { tutorialStep = 2; updateTutorial(); LK.setTimeout(function () { tutorialStep = 3; updateTutorial(); }, 2000); break; } } } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Plant = Container.expand(function (type, x, y) {
var self = Container.call(this);
self.plantType = type || 'daisy';
self.stage = 'empty'; // empty, seed, sprout, flower
self.lastWatered = 0;
self.planted = false;
self.waterNeed = self.plantType === 'daisy' ? 2 : 3; // days between watering
var pot = self.attachAsset('pot', {
anchorX: 0.5,
anchorY: 1
});
self.plantGraphics = null;
self.x = x;
self.y = y;
self.plant = function () {
if (self.stage === 'empty') {
self.stage = 'seed';
self.planted = true;
self.lastWatered = currentDay;
// Create green pixel that will grow over time
self.plantGraphics = self.addChild(LK.getAsset('sprout', {
anchorX: 0.5,
anchorY: 1,
scaleX: 0.1,
scaleY: 0.1
}));
self.plantGraphics.y = -5;
self.plantGraphics.height = 2; // Start with 1 pixel height
// Add visual planting effect
var plantEffect = self.addChild(LK.getAsset('seed', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 1,
scaleX: 2,
scaleY: 2
}));
plantEffect.y = -10;
tween(plantEffect, {
alpha: 0,
scaleX: 0.5,
scaleY: 0.5,
y: -30
}, {
duration: 800,
onFinish: function onFinish() {
plantEffect.destroy();
}
});
LK.getSound('plant').play();
}
};
self.water = function () {
if (self.planted && currentDay - self.lastWatered >= 1) {
self.lastWatered = currentDay;
var waterEffect = self.addChild(LK.getAsset('water', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.7
}));
waterEffect.y = -40;
tween(waterEffect, {
alpha: 0,
y: -80
}, {
duration: 1000,
onFinish: function onFinish() {
waterEffect.destroy();
}
});
LK.getSound('water').play();
}
};
self.harvest = function () {
if (self.stage === 'flower') {
if (self.plantGraphics) {
self.plantGraphics.destroy();
self.plantGraphics = null;
}
self.stage = 'empty';
self.planted = false;
LK.setScore(LK.getScore() + 10);
updateScoreText();
LK.getSound('harvest').play();
return true;
}
return false;
};
self.update = function () {
if (!self.planted) return;
var daysSinceWatered = currentDay - self.lastWatered;
var daysSincePlanted = currentDay - self.lastWatered;
// Green pixel growth - increases height each day
if (self.plantGraphics && self.stage === 'seed') {
var targetHeight = Math.min(2 + daysSincePlanted * 5, 30); // Grow 5 pixels per day, max 30
var targetScaleY = targetHeight / 30; // Scale based on target height
// Smooth growth animation
tween(self.plantGraphics, {
scaleY: targetScaleY,
y: -5 - targetHeight / 2
}, {
duration: 500,
easing: tween.easeOut
});
}
// Accelerated growth logic for immediate feedback
if (self.stage === 'seed' && daysSinceWatered <= self.waterNeed && daysSincePlanted >= 3) {
// Grow to sprout after 3 days
self.stage = 'sprout';
if (self.plantGraphics) {
self.plantGraphics.destroy();
}
self.plantGraphics = self.addChild(LK.getAsset('sprout', {
anchorX: 0.5,
anchorY: 1
}));
self.plantGraphics.y = -15;
// Add growth animation
tween(self.plantGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 1000,
easing: tween.bounceOut
});
} else if (self.stage === 'sprout' && daysSinceWatered <= self.waterNeed && daysSincePlanted >= 7) {
// Grow to flower after 7 days
self.stage = 'flower';
if (self.plantGraphics) {
self.plantGraphics.destroy();
}
var flowerAsset = self.plantType === 'daisy' ? 'daisyFlower' : 'geraniumFlower';
self.plantGraphics = self.addChild(LK.getAsset(flowerAsset, {
anchorX: 0.5,
anchorY: 1
}));
self.plantGraphics.y = -25;
// Add blooming animation
self.plantGraphics.scaleX = 0.1;
self.plantGraphics.scaleY = 0.1;
tween(self.plantGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 1500,
easing: tween.bounceOut
});
}
// Visual feedback for watering needs
if (self.planted && daysSinceWatered > self.waterNeed) {
pot.tint = 0xA0522D; // Darker brown when needs water
} else {
pot.tint = 0xCD853F; // Normal brown
}
};
self.down = function (x, y, obj) {
if (selectedAction === 'plant') {
if (self.stage === 'empty') {
self.plant();
// Show planting confirmation text
var plantText = self.addChild(new Text2('Planted!', {
size: 30,
fill: 0x228B22
}));
plantText.anchor.set(0.5, 0.5);
plantText.y = -60;
tween(plantText, {
alpha: 0,
y: -100
}, {
duration: 1500,
onFinish: function onFinish() {
plantText.destroy();
}
});
}
} else if (selectedAction === 'water') {
self.water();
} else if (selectedAction === 'harvest') {
self.harvest();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xFFE4B5
});
/****
* Game Code
****/
// Game state variables
var currentDay = 0;
var currentWeek = 1;
var dayProgress = 0;
var selectedAction = 'plant';
var plants = [];
var tutorialStep = 0;
var showingTutorial = true;
var seedCursor = null;
// Create background image
var bgImage = game.addChild(LK.getAsset('bg', {
anchorX: 0.5,
anchorY: 0.5
}));
bgImage.x = 2048 / 2;
bgImage.y = 2732 / 2;
bgImage.width = 2048;
bgImage.height = 2732;
// Create warm sunlight
var sunlight = game.addChild(LK.getAsset('sunlight', {
anchorX: 0.5,
anchorY: 0.5
}));
sunlight.x = 1700;
sunlight.y = 1000;
sunlight.alpha = 0.3;
// Create balcony railing
var railing = game.addChild(LK.getAsset('balconyRailing', {
anchorX: 0.5,
anchorY: 1
}));
railing.x = 2048 / 2;
railing.y = 2185;
// Create balcony floor
var balcony = game.addChild(LK.getAsset('balcony', {
anchorX: 0.5,
anchorY: 1
}));
balcony.x = 2048 / 2;
balcony.y = 2200;
// Create plant pots
for (var i = 0; i < 4; i++) {
var plantX = 600 + i * 270; // Increased spacing from 250 to 270 (20px more)
var plantY = 2170; // Moved down from 2150 to 2170 (20px down)
var plant = new Plant('daisy', plantX, plantY);
plants.push(plant);
game.addChild(plant);
}
// UI Elements
var scoreText = new Text2('Flowers: 0', {
size: 60,
fill: 0x4A4A4A
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
scoreText.y = 150;
var dayText = new Text2('Day 1', {
size: 50,
fill: 0x4A4A4A
});
dayText.anchor.set(1, 0);
LK.gui.topRight.addChild(dayText);
dayText.x = -50;
dayText.y = 100;
var weekText = new Text2('Week 1', {
size: 50,
fill: 0x4A4A4A
});
weekText.anchor.set(1, 0);
LK.gui.topRight.addChild(weekText);
weekText.x = -50;
weekText.y = 160;
// Action buttons
var plantButton = game.addChild(LK.getAsset('plantButton', {
anchorX: 0.5,
anchorY: 0.5
}));
plantButton.x = 400;
plantButton.y = 2500;
var plantButtonText = new Text2('PLANT', {
size: 40,
fill: 0xFFFFFF
});
plantButtonText.anchor.set(0.5, 0.5);
plantButton.addChild(plantButtonText);
var waterButton = game.addChild(LK.getAsset('waterButton', {
anchorX: 0.5,
anchorY: 0.5
}));
waterButton.x = 1024;
waterButton.y = 2500;
var waterButtonText = new Text2('WATER', {
size: 40,
fill: 0xFFFFFF
});
waterButtonText.anchor.set(0.5, 0.5);
waterButton.addChild(waterButtonText);
var harvestButton = game.addChild(LK.getAsset('harvestButton', {
anchorX: 0.5,
anchorY: 0.5
}));
harvestButton.x = 1648;
harvestButton.y = 2500;
var harvestButtonText = new Text2('HARVEST', {
size: 40,
fill: 0xFFFFFF
});
harvestButtonText.anchor.set(0.5, 0.5);
harvestButton.addChild(harvestButtonText);
// Tutorial text
var tutorialText = new Text2('Welcome to your balcony garden!\nTap PLANT to start growing daisies.', {
size: 45,
fill: 0x2F4F2F
});
tutorialText.anchor.set(0.5, 0.5);
tutorialText.x = 1024;
tutorialText.y = 1200;
game.addChild(tutorialText);
function updateScoreText() {
scoreText.setText('Flowers: ' + LK.getScore());
}
function updateDayText() {
dayText.setText('Day ' + (currentDay + 1));
weekText.setText('Week ' + currentWeek);
}
function updateButtonSelection() {
plantButton.tint = selectedAction === 'plant' ? 0xFFFFFF : 0xCCCCCC;
waterButton.tint = selectedAction === 'water' ? 0xFFFFFF : 0xCCCCCC;
harvestButton.tint = selectedAction === 'harvest' ? 0xFFFFFF : 0xCCCCCC;
// Show/hide seed cursor based on selected action
if (seedCursor) {
seedCursor.alpha = selectedAction === 'plant' ? 0.8 : 0;
}
}
function updateTutorial() {
if (!showingTutorial) return;
if (tutorialStep === 0) {
tutorialText.setText('Welcome to your balcony garden!\nTap PLANT to start growing daisies.');
} else if (tutorialStep === 1) {
tutorialText.setText('Great! Now tap on a pot to plant a daisy seed.');
} else if (tutorialStep === 2) {
tutorialText.setText('Perfect! Your daisy will grow over time.\nRemember to water it every 2 days.');
} else if (tutorialStep === 3) {
tutorialText.setText('Tap WATER, then tap your plant to water it.\nWatch it grow from seed to flower!');
showingTutorial = false;
LK.setTimeout(function () {
tutorialText.alpha = 0;
}, 3000);
}
}
// Button event handlers
plantButton.down = function () {
selectedAction = 'plant';
updateButtonSelection();
if (showingTutorial && tutorialStep === 0) {
tutorialStep = 1;
updateTutorial();
}
};
waterButton.down = function () {
selectedAction = 'water';
updateButtonSelection();
};
harvestButton.down = function () {
selectedAction = 'harvest';
updateButtonSelection();
};
// Create seed cursor (initially hidden)
seedCursor = game.addChild(LK.getAsset('seedCursor', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0
}));
// Mouse move handler for seed cursor
game.move = function (x, y, obj) {
if (selectedAction === 'plant' && seedCursor) {
seedCursor.x = x;
seedCursor.y = y;
seedCursor.alpha = 0.8;
}
};
// Initialize
updateButtonSelection();
updateScoreText();
updateDayText();
updateTutorial();
// Start ambient music
LK.playMusic('ambient');
// Day progression timer
var dayTimer = LK.setInterval(function () {
dayProgress += 1;
// Day-night cycle visual effect
var timeOfDay = dayProgress % 240 / 240; // 4 second day cycle
var brightness = 0.4 + 0.6 * Math.abs(Math.sin(timeOfDay * Math.PI));
var baseColor = 0xFFE4B5; // Warm peachy background
var r = (baseColor >> 16 & 0xFF) * brightness;
var g = (baseColor >> 8 & 0xFF) * brightness;
var b = (baseColor & 0xFF) * brightness;
var nightColor = r << 16 | g << 8 | b;
game.setBackgroundColor(nightColor);
// Update sunlight opacity for day/night
sunlight.alpha = 0.1 + 0.4 * Math.abs(Math.sin(timeOfDay * Math.PI));
// Advance day every 10 seconds
if (dayProgress % 600 === 0) {
currentDay++;
if (currentDay % 7 === 0) {
currentWeek++;
// Week 2: Add geraniums
if (currentWeek === 2) {
for (var i = 0; i < 2; i++) {
var plantX = 1800 + i * 220; // Increased spacing from 200 to 220 (20px more)
var plantY = 2170; // Moved down from 2150 to 2170 (20px down)
var geranium = new Plant('geranium', plantX, plantY);
plants.push(geranium);
game.addChild(geranium);
}
}
}
updateDayText();
}
}, 100);
game.update = function () {
// Update all plants
for (var i = 0; i < plants.length; i++) {
plants[i].update();
}
// Check for tutorial progression
if (showingTutorial && tutorialStep === 1) {
for (var j = 0; j < plants.length; j++) {
if (plants[j].planted) {
tutorialStep = 2;
updateTutorial();
LK.setTimeout(function () {
tutorialStep = 3;
updateTutorial();
}, 2000);
break;
}
}
}
};