User prompt
Put the shoot button in the bottom right corner also fix the shoe button for when I click it with my finger in my mold device the dog summer shoots the green bullet things and also for some reason the bullets on either side aren’t doing any damage to each other fix that
User prompt
Make a shoot button in the corner of the boss, right
User prompt
Lana boss fight Lana is summer. Sister is a super jacked tan chihuahua you fight her make a Lana boss fight in the main menu, make a little button for it and make little mechanics for it also make assets for the boss fight. I’m gonna need the Lana asset to be tall and thin, but not too thin. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make assets for the city builder also make a little people walk around and little cars that drive around in the new street that will be added also assets ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
City builder mode in main menu
User prompt
In the classic arcade Stacker game, there are blocks that move horizontally back and forth across the screen at each level. The player needs to time their button press (or screen tap in this mobile version) to stop the moving blocks when they are perfectly aligned with the blocks from the previous level below them. Here's what happens in the game: 1. **Moving Blocks**: At each level, a row of blocks moves left and right across the screen 2. **Timing Challenge**: The player must tap the screen at the precise moment when the moving blocks are aligned with the stationary blocks from the level below 3. **Stacking**: Successfully aligned blocks become part of the tower and the game moves to the next level 4. **Penalty**: Blocks that aren't aligned when the player taps fall away and are removed from the game 5. **Progressive Difficulty**: As you go higher, the blocks move faster and there are fewer blocks to work with The "little block going" is essentially the core gameplay mechanic - these are the animated blocks that the player needs to stop at the right time to build their tower successfully. The challenge is in the timing and precision required to align them properly with the existing tower structure. Implement this into the game. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Timeout.tick error: undefined is not an object (evaluating 'stackerBlocks[stackerCurrentLevel - 1].length')' in or related to this line: 'var previousLevelBlocks = stackerCurrentLevel === 1 ? stackerRowWidth : stackerBlocks[stackerCurrentLevel - 1].length;' Line Number: 1984 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Stacker ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
⏪Revert to here JO L make the famous arcade games stacker put stacker in the game menu and make a game in the mini games and when you fill in stacker it resets the mini game to the stage where you were start ↪💡 Consider importing and using the following plugins: @upit/tween.v1 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Football block that I know is a big white circle with bright red indicators of we’re supposed to tap and the little line that has to be in the indicator for the point to score goes around the circle and that’s also green. Make the colors of every mini game brighter. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Now make the Lock game game ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Fix the script, error and everything related into it that could possibly be one ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(popLockGameButton, {' Line Number: 2652 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add a pop Lock to the mini game menu
User prompt
Make it back the menu button in the main game
User prompt
OK now add Catch the treats ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
OK now add pattern Repeat ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
When I click a memory match or any other games, make something happen make the mini game start
User prompt
Fix everything like can possibly be script error and anything that is a script error and anything that would be related that would be a script error
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(memoryGameButton, {' Line Number: 1853 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Fix everything that can possibly be a script error
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(memoryGameButton, {' Line Number: 1853
User prompt
Make memories other mini games in the mini games menu that can appear again on the main menu or the main game of course the game menu you can go back to where you clicked it first so you’re not trapped in the mini games
User prompt
Either fix or remove purple
User prompt
Just remove yellow from the pallet
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var ArtBrush = Container.expand(function () { var self = Container.call(this); var brushGraphics = self.attachAsset('brush', { anchorX: 0.5, anchorY: 0.5 }); self.isActive = false; self.activate = function () { self.isActive = true; tween(self, { scaleX: 1.2, scaleY: 1.2 }, { duration: 300, easing: tween.easeOut }); }; self.deactivate = function () { self.isActive = false; tween(self, { scaleX: 1.0, scaleY: 1.0 }, { duration: 300, easing: tween.easeIn }); }; return self; }); var ArtCanvas = Container.expand(function () { var self = Container.call(this); var canvasGraphics = self.attachAsset('canvas', { anchorX: 0.5, anchorY: 0.5 }); self.strokes = []; self.currentColor = 0x000000; self.currentStrokeAsset = 'paintStrokeBlack'; self.isDrawing = false; self.addStroke = function (x, y) { var stroke = self.addChild(LK.getAsset(self.currentStrokeAsset, { anchorX: 0.5, anchorY: 0.5 })); stroke.x = x; stroke.y = y; self.strokes.push(stroke); // Add paint splash effect tween(stroke, { scaleX: 1.5, scaleY: 1.5 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(stroke, { scaleX: 1.0, scaleY: 1.0 }, { duration: 200, easing: tween.easeIn }); } }); }; self.setColor = function (color) { self.currentColor = color; console.log("Setting color to:", color, "hex:", color.toString(16)); // Map color values to stroke assets if (color === 0xff0000) { self.currentStrokeAsset = 'paintStrokeRed'; } else if (color === 0x00ff00) { self.currentStrokeAsset = 'paintStrokeGreen'; } else if (color === 0x0000ff) { self.currentStrokeAsset = 'paintStrokeBlue'; } else if (color === 0xff00ff) { self.currentStrokeAsset = 'paintStrokeMagenta'; } else if (color === 0x00ffff) { self.currentStrokeAsset = 'paintStrokeCyan'; } else if (color === 0xffffff) { self.currentStrokeAsset = 'paintStrokeWhite'; } else if (color === 0x000000) { self.currentStrokeAsset = 'paintStrokeBlack'; } else { self.currentStrokeAsset = 'paintStrokeBlack'; console.log("Unknown color, defaulting to black"); } console.log("Current stroke asset set to:", self.currentStrokeAsset); }; self.clearCanvas = function () { for (var i = 0; i < self.strokes.length; i++) { self.strokes[i].destroy(); } self.strokes = []; }; return self; }); var ColorPalette = Container.expand(function () { var self = Container.call(this); self.colors = [0xff0000, 0x00ff00, 0x0000ff, 0xff00ff, 0x00ffff, 0x000000, 0xffffff]; self.colorAssets = ['colorRed', 'colorGreen', 'colorBlue', 'colorMagenta', 'colorCyan', 'colorBlack', 'colorWhite']; self.colorButtons = []; for (var i = 0; i < self.colors.length; i++) { var colorButton = self.addChild(LK.getAsset(self.colorAssets[i], { anchorX: 0.5, anchorY: 0.5 })); colorButton.x = i % 4 * 100; colorButton.y = Math.floor(i / 4) * 100; colorButton.colorValue = self.colors[i]; colorButton.assetName = self.colorAssets[i]; self.colorButtons.push(colorButton); // Add hover effect with scale animation colorButton.originalScale = 1.0; colorButton.down = function (x, y, obj) { tween(this, { scaleX: 1.2, scaleY: 1.2 }, { duration: 150, easing: tween.easeOut, onFinish: function () { tween(this, { scaleX: 1.0, scaleY: 1.0 }, { duration: 150, easing: tween.easeIn }); }.bind(this) }); }.bind(colorButton); } return self; }); var Food = Container.expand(function () { var self = Container.call(this); var foodGraphics = self.attachAsset('food', { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { self.feed(); }; self.feed = function () { // Create food next to Summer var foodToEat = new Food(); foodToEat.x = summer.x + 60; foodToEat.y = summer.y - 50; game.addChild(foodToEat); // Animate food moving to Summer's mouth and shrinking tween(foodToEat, { x: summer.x, y: summer.y - 80, scaleX: 0.3, scaleY: 0.3 }, { duration: 800, easing: tween.easeInOut, onFinish: function onFinish() { // Make food disappear with eating animation tween(foodToEat, { alpha: 0, scaleX: 0, scaleY: 0 }, { duration: 300, easing: tween.easeIn, onFinish: function onFinish() { foodToEat.destroy(); } }); } }); hunger = Math.min(100, hunger + 20); happiness = Math.min(100, happiness + 10); updateHungerBar(); updateHappinessBar(); LK.getSound('eat').play(); LK.setTimeout(function () { LK.getSound('yummy').play(); summer.showSpeechBubble("Yummy!"); }, 500); // Remove from foods array var index = foods.indexOf(self); if (index > -1) { foods.splice(index, 1); } self.destroy(); }; return self; }); var GroomBrush = Container.expand(function () { var self = Container.call(this); var brushGraphics = self.attachAsset('groomBrush', { anchorX: 0.5, anchorY: 0.5 }); self.performGrooming = function () { // Start grooming animation - move brush back and forth tween(self, { x: self.x + 50, rotation: 0.3 }, { duration: 300, easing: tween.easeInOut, onFinish: function onFinish() { tween(self, { x: self.x - 100, rotation: -0.3 }, { duration: 400, easing: tween.easeInOut, onFinish: function onFinish() { tween(self, { x: self.x + 50, rotation: 0, alpha: 0, scaleX: 0.5, scaleY: 0.5 }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); } }); } }); }; return self; }); var Heart = Container.expand(function () { var self = Container.call(this); var heartGraphics = self.attachAsset('heart', { anchorX: 0.5, anchorY: 0.5 }); self.floatUp = function () { tween(self, { y: self.y - 150, alpha: 0 }, { duration: 1500, easing: tween.easeOut, onFinish: function onFinish() { var index = hearts.indexOf(self); if (index > -1) { hearts.splice(index, 1); } self.destroy(); } }); }; return self; }); var Summer = Container.expand(function () { var self = Container.call(this); var summerGraphics = self.attachAsset('summer', { anchorX: 0.5, anchorY: 1.0 }); self.originalScale = 1.0; self.isAnimating = false; self.down = function (x, y, obj) { if (!self.isAnimating) { self.pet(); } }; self.pet = function () { happiness = Math.min(100, happiness + 5); updateHappinessBar(); LK.getSound('bark').play(); self.createHeart(); self.bounce(); self.showSpeechBubble("Woof!"); }; self.createHeart = function () { var heart = new Heart(); heart.x = self.x + (Math.random() - 0.5) * 100; heart.y = self.y - 50; game.addChild(heart); hearts.push(heart); }; self.bounce = function () { if (self.isAnimating) return; self.isAnimating = true; tween(self, { scaleX: 1.2, scaleY: 1.2 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { scaleX: self.originalScale, scaleY: self.originalScale }, { duration: 200, easing: tween.easeIn, onFinish: function onFinish() { self.isAnimating = false; } }); } }); }; self.playAnimation = function () { if (self.isAnimating) return; self.isAnimating = true; tween(self, { rotation: 0.2 }, { duration: 300, easing: tween.easeInOut, onFinish: function onFinish() { tween(self, { rotation: -0.2 }, { duration: 300, easing: tween.easeInOut, onFinish: function onFinish() { tween(self, { rotation: 0 }, { duration: 300, easing: tween.easeInOut, onFinish: function onFinish() { self.isAnimating = false; } }); } }); } }); }; self.showSpeechBubble = function (text) { var speechBubble = new Text2(text, { size: 40, fill: 0x000000 }); speechBubble.anchor.set(0.5, 1); speechBubble.x = self.x; speechBubble.y = self.y - summerGraphics.height / 2 - 20; // Position above Summer's head game.addChild(speechBubble); tween(speechBubble, { alpha: 0, y: speechBubble.y - 50 }, { duration: 1500, easing: tween.easeOut, onFinish: function onFinish() { speechBubble.destroy(); } }); }; return self; }); var Toy = Container.expand(function () { var self = Container.call(this); var toyGraphics = self.attachAsset('toy', { anchorX: 0.5, anchorY: 0.5 }); self.isDragging = false; self.down = function (x, y, obj) { self.isDragging = true; self.startDragX = x; self.startDragY = y; }; self.checkPlayInteraction = function () { var distance = Math.sqrt(Math.pow(self.x - summer.x, 2) + Math.pow(self.y - summer.y, 2)); if (distance < 150) { happiness = Math.min(100, happiness + 15); updateHappinessBar(); LK.getSound('play').play(); summer.playAnimation(); summer.showSpeechBubble("Zoomies!"); // Remove from toys array var index = toys.indexOf(self); if (index > -1) { toys.splice(index, 1); } self.destroy(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xFFB6C1 }); /**** * Game Code ****/ // Add Array.find polyfill for compatibility if (!Array.prototype.find) { Array.prototype.find = function (predicate) { if (this === null) { throw new TypeError('Array.prototype.find called on null or undefined'); } if (typeof predicate !== 'function') { throw new TypeError('predicate must be a function'); } var list = Object(this); var length = parseInt(list.length) || 0; var thisArg = arguments[1]; var value; for (var i = 0; i < length; i++) { value = list[i]; if (predicate.call(thisArg, value, i, list)) { return value; } } return undefined; }; } var gameState = 'splash'; // 'splash', 'menu', 'playing', or 'art' var menuSummer = null; var gamePlayElements = []; var happiness = 100; var hunger = 100; var foods = []; var toys = []; var hearts = []; var draggedToy = null; var summer = null; var happinessBarFill = null; var hungerBarFill = null; var happinessText = null; var hungerText = null; // Art studio mode variables var artCanvas = null; var colorPalette = null; var artBrush = null; var artModeElements = []; var isDrawing = false; var lastDrawX = 0; var lastDrawY = 0; // Create splash screen function createSplashScreen() { // Black background already set in game initialization game.setBackgroundColor(0x000000); // Create logo var logo = game.addChild(LK.getAsset('summerLogo', { anchorX: 0.5, anchorY: 0.5 })); logo.x = 1024; logo.y = 1200; // Create text var splashText = new Text2('Summer Productions Presents', { size: 80, fill: 0xFFFFFF }); splashText.anchor.set(0.5, 0.5); splashText.x = 1024; splashText.y = 1500; game.addChild(splashText); // Fade in animation logo.alpha = 0; splashText.alpha = 0; tween(logo, { alpha: 1 }, { duration: 1000, easing: tween.easeInOut }); tween(splashText, { alpha: 1 }, { duration: 1000, easing: tween.easeInOut }); // Music will start when transitioning to menu // After 4 seconds, transition to main menu LK.setTimeout(function () { // Fade out splash screen tween(logo, { alpha: 0 }, { duration: 500, easing: tween.easeInOut }); tween(splashText, { alpha: 0 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { logo.destroy(); splashText.destroy(); gameState = 'menu'; game.setBackgroundColor(0xFFB6C1); // Start music when transitioning to menu LK.playMusic('bgmusic', { loop: true }); createMainMenu(); } }); }, 4000); } // Create main menu function createMainMenu() { // Music will start when title flies in // Game title - start off screen var titleText = new Text2('RAISE A SUMMER', { size: 120, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = -500; // Start off screen left titleText.y = 800; game.addChild(titleText); // Fly in animation tween(titleText, { x: 1024 }, { duration: 1500, easing: tween.easeOut }); // Music already started during splash screen // Add pulsing animation to title function animateTitle() { tween(titleText, { scaleX: 1.1, scaleY: 1.1 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { tween(titleText, { scaleX: 1.0, scaleY: 1.0 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { if (gameState === 'menu') { animateTitle(); } } }); } }); } animateTitle(); // Play button var menuPlayButton = game.addChild(LK.getAsset('barBackground', { anchorX: 0.5, anchorY: 0.5 })); menuPlayButton.width = 400; menuPlayButton.height = 150; menuPlayButton.x = 1024; menuPlayButton.y = 1300; menuPlayButton.tint = 0x32CD32; var menuPlayButtonText = new Text2('PLAY', { size: 80, fill: 0xFFFFFF }); menuPlayButtonText.anchor.set(0.5, 0.5); menuPlayButtonText.x = menuPlayButton.x; menuPlayButtonText.y = menuPlayButton.y; game.addChild(menuPlayButtonText); // Art Studio button var menuArtButton = game.addChild(LK.getAsset('barBackground', { anchorX: 0.5, anchorY: 0.5 })); menuArtButton.width = 400; menuArtButton.height = 150; menuArtButton.x = 1024; menuArtButton.y = 1500; menuArtButton.tint = 0x9370DB; var menuArtButtonText = new Text2('ART STUDIO', { size: 70, fill: 0xFFFFFF }); menuArtButtonText.anchor.set(0.5, 0.5); menuArtButtonText.x = menuArtButton.x; menuArtButtonText.y = menuArtButton.y; game.addChild(menuArtButtonText); // Add bouncing animation to menu play button function animateMenuPlayButton() { tween(menuPlayButton, { y: menuPlayButton.y - 20 }, { duration: 1000, easing: tween.easeInOut, onFinish: function onFinish() { tween(menuPlayButton, { y: menuPlayButton.y + 20 }, { duration: 1000, easing: tween.easeInOut, onFinish: function onFinish() { if (gameState === 'menu') { animateMenuPlayButton(); } } }); } }); tween(menuPlayButtonText, { y: menuPlayButtonText.y - 20 }, { duration: 1000, easing: tween.easeInOut, onFinish: function onFinish() { tween(menuPlayButtonText, { y: menuPlayButtonText.y + 20 }, { duration: 1000, easing: tween.easeInOut, onFinish: function onFinish() { if (gameState === 'menu') { animateMenuPlayButton(); } } }); } }); } animateMenuPlayButton(); // Add subtitle var subtitleText = new Text2('Your Virtual Pet Companion', { size: 60, fill: 0xFFB6C1 }); subtitleText.anchor.set(0.5, 0.5); subtitleText.x = 1024; subtitleText.y = 950; subtitleText.alpha = 0; game.addChild(subtitleText); // Fade in subtitle after a delay LK.setTimeout(function () { if (gameState === 'menu') { tween(subtitleText, { alpha: 1 }, { duration: 1500, easing: tween.easeInOut }); } }, 1000); // Create ten floating Summer characters in background var floatingSummers = []; for (var s = 0; s < 10; s++) { var floatingSummer = game.addChild(new Summer()); floatingSummer.x = Math.random() * 2048; floatingSummer.y = Math.random() * 2732; floatingSummer.alpha = 0.6; // Make them semi-transparent floatingSummer.scaleX = 0.7; // Make them smaller floatingSummer.scaleY = 0.7; floatingSummers.push(floatingSummer); // Start individual floating animation for each Summer startIndividualFloatingAnimation(floatingSummer); } // Store the main menu Summer (keeping original behavior) menuSummer = floatingSummers[0]; // Make the first one more prominent menuSummer.alpha = 1.0; menuSummer.scaleX = 1.0; menuSummer.scaleY = 1.0; // Add floating food decorations var decorativeItems = []; var _loop = function _loop() { decorativeFood = game.addChild(LK.getAsset('food', { anchorX: 0.5, anchorY: 0.5 })); decorativeFood.x = Math.random() * 2048; decorativeFood.y = Math.random() * 2732; decorativeFood.alpha = 0.3; decorativeFood.scaleX = 0.5; decorativeFood.scaleY = 0.5; decorativeItems.push(decorativeFood); // Float around randomly function floatDecoration(item) { tween(item, { x: Math.random() * 2048, y: Math.random() * 2732, rotation: item.rotation + (Math.random() - 0.5) * Math.PI }, { duration: 5000 + Math.random() * 3000, easing: tween.easeInOut, onFinish: function onFinish() { if (gameState === 'menu') { floatDecoration(item); } } }); } floatDecoration(decorativeFood); }, decorativeFood; for (var i = 0; i < 8; i++) { _loop(); } // Add bouncing animation to art studio button function animateMenuArtButton() { tween(menuArtButton, { y: menuArtButton.y - 15 }, { duration: 1200, easing: tween.easeInOut, onFinish: function onFinish() { tween(menuArtButton, { y: menuArtButton.y + 15 }, { duration: 1200, easing: tween.easeInOut, onFinish: function onFinish() { if (gameState === 'menu') { animateMenuArtButton(); } } }); } }); tween(menuArtButtonText, { y: menuArtButtonText.y - 15 }, { duration: 1200, easing: tween.easeInOut, onFinish: function onFinish() { tween(menuArtButtonText, { y: menuArtButtonText.y + 15 }, { duration: 1200, easing: tween.easeInOut, onFinish: function onFinish() { if (gameState === 'menu') { animateMenuArtButton(); } } }); } }); } animateMenuArtButton(); // Store menu elements for cleanup gamePlayElements = [titleText, subtitleText, menuPlayButton, menuPlayButtonText, menuArtButton, menuArtButtonText].concat(decorativeItems); } function startFloatingAnimation() { if (!menuSummer) return; // Random floating movement - use full screen dimensions with boundaries // Screen is 2048x2732, leave margin for Summer's size (200px) var margin = 100; var targetX = margin + Math.random() * (2048 - 2 * margin); var targetY = margin + Math.random() * (2732 - 2 * margin); tween(menuSummer, { x: targetX, y: targetY, rotation: (Math.random() - 0.5) * 0.5 }, { duration: 3000 + Math.random() * 2000, easing: tween.easeInOut, onFinish: function onFinish() { // Do a flip if (!menuSummer) return; tween(menuSummer, { rotation: menuSummer.rotation + Math.PI * 2 }, { duration: 800, easing: tween.easeInOut, onFinish: function onFinish() { // Continue floating startFloatingAnimation(); } }); } }); // Spawn floating hearts around Summer if (Math.random() < 0.3) { var menuHeart = new Heart(); menuHeart.x = menuSummer.x + (Math.random() - 0.5) * 150; menuHeart.y = menuSummer.y + (Math.random() - 0.5) * 150; game.addChild(menuHeart); menuHeart.floatUp(); } } function startIndividualFloatingAnimation(summerChar) { if (!summerChar || gameState !== 'menu') return; // Random floating movement - use full screen dimensions with boundaries // Screen is 2048x2732, leave margin for Summer's size (200px) var margin = 100; var targetX = margin + Math.random() * (2048 - 2 * margin); var targetY = margin + Math.random() * (2732 - 2 * margin); tween(summerChar, { x: targetX, y: targetY, rotation: (Math.random() - 0.5) * 0.5 }, { duration: 4000 + Math.random() * 3000, easing: tween.easeInOut, onFinish: function onFinish() { // Do a gentle rotation if (!summerChar || gameState !== 'menu') return; tween(summerChar, { rotation: summerChar.rotation + (Math.random() - 0.5) * Math.PI }, { duration: 1000, easing: tween.easeInOut, onFinish: function onFinish() { // Continue floating startIndividualFloatingAnimation(summerChar); } }); } }); // Occasionally spawn floating hearts around this Summer if (Math.random() < 0.2) { var menuHeart = new Heart(); menuHeart.x = summerChar.x + (Math.random() - 0.5) * 150; menuHeart.y = summerChar.y + (Math.random() - 0.5) * 150; game.addChild(menuHeart); menuHeart.floatUp(); } } function startArtStudio() { // Store previous game state var previousState = gameState; // Remove menu elements if coming from menu if (previousState === 'menu') { for (var i = 0; i < gamePlayElements.length; i++) { gamePlayElements[i].destroy(); } gamePlayElements = []; // Remove all floating summers if (menuSummer) { var children = game.children.slice(); for (var i = 0; i < children.length; i++) { if (children[i] instanceof Summer) { children[i].destroy(); } } menuSummer = null; } } // If coming from gameplay, hide game UI elements but preserve Summer if (previousState === 'playing') { // Hide UI elements but don't destroy them var gameChildren = game.children.slice(); for (var i = 0; i < gameChildren.length; i++) { var child = gameChildren[i]; // Hide everything except Summer and hearts if (!(child instanceof Summer) && !(child instanceof Heart)) { child.visible = false; } } } // Create art studio elements createArtStudio(); gameState = 'art'; } function createArtStudio() { // Create title var artTitle = new Text2('ART STUDIO', { size: 100, fill: 0x4B0082 }); artTitle.anchor.set(0.5, 0.5); artTitle.x = 1024; artTitle.y = 200; game.addChild(artTitle); artModeElements.push(artTitle); // Create canvas artCanvas = game.addChild(new ArtCanvas()); artCanvas.x = 1024; artCanvas.y = 1200; artModeElements.push(artCanvas); // Create color palette colorPalette = game.addChild(new ColorPalette()); colorPalette.x = 200; colorPalette.y = 600; artModeElements.push(colorPalette); // Create brush artBrush = game.addChild(new ArtBrush()); if (artBrush) { artBrush.x = 200; artBrush.y = 400; artBrush.activate(); artModeElements.push(artBrush); } // Create or reposition Summer in art mode if (!summer) { summer = game.addChild(new Summer()); artModeElements.push(summer); } summer.x = 1800; summer.y = 800; summer.scaleX = 0.8; summer.scaleY = 0.8; summer.visible = true; // Ensure Summer appears in front of canvas game.removeChild(summer); game.addChild(summer); // Add art studio buttons var backButton = game.addChild(LK.getAsset('barBackground', { anchorX: 0.5, anchorY: 0.5 })); backButton.width = 200; backButton.height = 80; backButton.x = 150; backButton.y = 2600; backButton.tint = 0x808080; artModeElements.push(backButton); var backButtonText = new Text2('BACK', { size: 40, fill: 0xFFFFFF }); backButtonText.anchor.set(0.5, 0.5); backButtonText.x = backButton.x; backButtonText.y = backButton.y; game.addChild(backButtonText); artModeElements.push(backButtonText); var clearButton = game.addChild(LK.getAsset('barBackground', { anchorX: 0.5, anchorY: 0.5 })); clearButton.width = 200; clearButton.height = 80; clearButton.x = 400; clearButton.y = 2600; clearButton.tint = 0xff4444; artModeElements.push(clearButton); var clearButtonText = new Text2('CLEAR', { size: 40, fill: 0xFFFFFF }); clearButtonText.anchor.set(0.5, 0.5); clearButtonText.x = clearButton.x; clearButtonText.y = clearButton.y; game.addChild(clearButtonText); artModeElements.push(clearButtonText); // Add instructions var instructions = new Text2('Tap colors to change brush, draw on canvas!', { size: 45, fill: 0x333333 }); instructions.anchor.set(0.5, 0.5); instructions.x = 1024; instructions.y = 2650; game.addChild(instructions); artModeElements.push(instructions); } function startGame() { // Music already playing - no transition needed // Remove menu elements for (var i = 0; i < gamePlayElements.length; i++) { gamePlayElements[i].destroy(); } gamePlayElements = []; // Remove all floating summers if (menuSummer) { // Find and destroy all Summer instances in the game var children = game.children.slice(); // Create a copy to iterate safely for (var i = 0; i < children.length; i++) { if (children[i] instanceof Summer) { children[i].destroy(); } } menuSummer = null; } // Create game Summer summer = game.addChild(new Summer()); summer.x = 1024; summer.y = 2200; // Create game UI and elements createGameUI(); gameState = 'playing'; } function createGameUI() { // Create UI bars var happinessBarBg = game.addChild(LK.getAsset('barBackground', { anchorX: 0, anchorY: 0 })); happinessBarBg.x = 200; happinessBarBg.y = 150; happinessBarFill = game.addChild(LK.getAsset('happinessBar', { anchorX: 0, anchorY: 0 })); happinessBarFill.x = 200; happinessBarFill.y = 150; var hungerBarBg = game.addChild(LK.getAsset('barBackground', { anchorX: 0, anchorY: 0 })); hungerBarBg.x = 200; hungerBarBg.y = 250; hungerBarFill = game.addChild(LK.getAsset('hungerBar', { anchorX: 0, anchorY: 0 })); hungerBarFill.x = 200; hungerBarFill.y = 250; // Create UI text happinessText = new Text2('Happiness: 100', { size: 50, fill: 0x000000 }); happinessText.anchor.set(0, 0.5); happinessText.x = 650; happinessText.y = 170; game.addChild(happinessText); hungerText = new Text2('Hunger: 100', { size: 50, fill: 0x000000 }); hungerText.anchor.set(0, 0.5); hungerText.x = 650; hungerText.y = 270; game.addChild(hungerText); var instructionText = new Text2('Use buttons below to care for Summer!', { size: 40, fill: 0x333333 }); instructionText.anchor.set(0.5, 1); instructionText.x = 1024; instructionText.y = 2680; game.addChild(instructionText); // Create command buttons var buttonWidth = 300; var buttonHeight = 120; var buttonY = 2400; var buttonSpacing = 400; // Store button references globally window.petButton = null; window.feedButton = null; window.playButton = null; window.groomButton = null; // Pet button var petButton = game.addChild(LK.getAsset('barBackground', { anchorX: 0.5, anchorY: 0.5 })); petButton.width = buttonWidth; petButton.height = buttonHeight; petButton.x = 300; petButton.y = buttonY; petButton.tint = 0xFF69B4; window.petButton = petButton; // Add gentle pulsing animation to pet button function animatePetButton() { tween(petButton, { scaleX: 1.05, scaleY: 1.05 }, { duration: 1500, easing: tween.easeInOut, onFinish: function onFinish() { tween(petButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 1500, easing: tween.easeInOut, onFinish: function onFinish() { if (gameState === 'playing') { animatePetButton(); } } }); } }); } animatePetButton(); var petButtonText = new Text2('PET', { size: 50, fill: 0xFFFFFF }); petButtonText.anchor.set(0.5, 0.5); petButtonText.x = petButton.x; petButtonText.y = petButton.y; game.addChild(petButtonText); // Feed button var feedButton = game.addChild(LK.getAsset('barBackground', { anchorX: 0.5, anchorY: 0.5 })); feedButton.width = buttonWidth; feedButton.height = buttonHeight; feedButton.x = 700; feedButton.y = buttonY; feedButton.tint = 0x32CD32; window.feedButton = feedButton; // Add floating animation to feed button function animateFeedButton() { tween(feedButton, { y: buttonY - 10, rotation: 0.05 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { tween(feedButton, { y: buttonY, rotation: -0.05 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { if (gameState === 'playing') { animateFeedButton(); } } }); } }); } animateFeedButton(); var feedButtonText = new Text2('FEED', { size: 50, fill: 0xFFFFFF }); feedButtonText.anchor.set(0.5, 0.5); feedButtonText.x = feedButton.x; feedButtonText.y = feedButton.y; game.addChild(feedButtonText); // Play button var playButton = game.addChild(LK.getAsset('barBackground', { anchorX: 0.5, anchorY: 0.5 })); playButton.width = buttonWidth; playButton.height = buttonHeight; playButton.x = 1100; playButton.y = buttonY; playButton.tint = 0x4169E1; window.playButton = playButton; var playButtonText = new Text2('PLAY', { size: 50, fill: 0xFFFFFF }); playButtonText.anchor.set(0.5, 0.5); playButtonText.x = playButton.x; playButtonText.y = playButton.y; game.addChild(playButtonText); // Groom button var groomButton = game.addChild(LK.getAsset('barBackground', { anchorX: 0.5, anchorY: 0.5 })); groomButton.width = buttonWidth; groomButton.height = buttonHeight; groomButton.x = 1500; groomButton.y = buttonY; groomButton.tint = 0x9370DB; window.groomButton = groomButton; // Add wobble animation to play button var _animatePlayButton = function animatePlayButton() { tween(playButton, { rotation: 0.1, scaleX: 1.02, scaleY: 1.02 }, { duration: 1200, easing: tween.easeInOut, onFinish: function onFinish() { tween(playButton, { rotation: -0.1, scaleX: 0.98, scaleY: 0.98 }, { duration: 1200, easing: tween.easeInOut, onFinish: function onFinish() { if (gameState === 'playing') { _animatePlayButton(); } } }); } }); }; _animatePlayButton(); var groomButtonText = new Text2('GROOM', { size: 50, fill: 0xFFFFFF }); groomButtonText.anchor.set(0.5, 0.5); groomButtonText.x = groomButton.x; groomButtonText.y = groomButton.y; game.addChild(groomButtonText); // Add gentle shake animation to groom button function animateGroomButton() { tween(groomButton, { x: 1500 + 5, rotation: 0.08 }, { duration: 800, easing: tween.easeInOut, onFinish: function onFinish() { tween(groomButton, { x: 1500 - 5, rotation: -0.08 }, { duration: 800, easing: tween.easeInOut, onFinish: function onFinish() { tween(groomButton, { x: 1500, rotation: 0 }, { duration: 400, easing: tween.easeInOut, onFinish: function onFinish() { if (gameState === 'playing') { LK.setTimeout(function () { animateGroomButton(); }, 2000); } } }); } }); } }); } animateGroomButton(); // Art Studio button var artStudioButton = game.addChild(LK.getAsset('barBackground', { anchorX: 0.5, anchorY: 0.5 })); artStudioButton.width = 200; artStudioButton.height = 80; artStudioButton.x = 1024; artStudioButton.y = 2580; artStudioButton.tint = 0x9370DB; window.artStudioButton = artStudioButton; var artStudioButtonText = new Text2('ART', { size: 40, fill: 0xFFFFFF }); artStudioButtonText.anchor.set(0.5, 0.5); artStudioButtonText.x = artStudioButton.x; artStudioButtonText.y = artStudioButton.y; game.addChild(artStudioButtonText); // Add floating animation to art studio button function animateArtStudioButton() { tween(artStudioButton, { y: 2570, scaleX: 1.05, scaleY: 1.05 }, { duration: 1400, easing: tween.easeInOut, onFinish: function onFinish() { tween(artStudioButton, { y: 2580, scaleX: 1.0, scaleY: 1.0 }, { duration: 1400, easing: tween.easeInOut, onFinish: function onFinish() { if (gameState === 'playing') { animateArtStudioButton(); } } }); } }); tween(artStudioButtonText, { y: 2570 }, { duration: 1400, easing: tween.easeInOut, onFinish: function onFinish() { tween(artStudioButtonText, { y: 2580 }, { duration: 1400, easing: tween.easeInOut, onFinish: function onFinish() { if (gameState === 'playing') { animateArtStudioButton(); } } }); } }); } animateArtStudioButton(); // Initial spawn spawnFood(); spawnToy(); } // Timers var hungerTimer = 0; var happinessTimer = 0; var foodSpawnTimer = 0; var toySpawnTimer = 0; // Initialize splash screen createSplashScreen(); // Background music already playing function updateHappinessBar() { var percentage = happiness / 100; if (happinessBarFill) { // Stop any existing tween on the bar tween.stop(happinessBarFill, { width: true }); // Animate the bar width change tween(happinessBarFill, { width: 400 * percentage }, { duration: 500, easing: tween.easeOut }); // Add a brief pulse effect tween(happinessBarFill, { scaleY: 1.2 }, { duration: 150, easing: tween.easeOut, onFinish: function onFinish() { tween(happinessBarFill, { scaleY: 1.0 }, { duration: 150, easing: tween.easeIn }); } }); if (happiness > 60) { happinessBarFill.tint = 0x00FF00; } else if (happiness > 30) { happinessBarFill.tint = 0xFFFF00; } else { happinessBarFill.tint = 0xFF0000; } } if (happinessText) { happinessText.setText('Happiness: ' + happiness); // Add text bounce effect tween(happinessText, { scaleX: 1.1, scaleY: 1.1 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(happinessText, { scaleX: 1.0, scaleY: 1.0 }, { duration: 200, easing: tween.easeIn }); } }); } } function updateHungerBar() { var percentage = hunger / 100; if (hungerBarFill) { // Stop any existing tween on the bar tween.stop(hungerBarFill, { width: true }); // Animate the bar width change tween(hungerBarFill, { width: 400 * percentage }, { duration: 500, easing: tween.easeOut }); // Add a brief pulse effect tween(hungerBarFill, { scaleY: 1.2 }, { duration: 150, easing: tween.easeOut, onFinish: function onFinish() { tween(hungerBarFill, { scaleY: 1.0 }, { duration: 150, easing: tween.easeIn }); } }); if (hunger > 60) { hungerBarFill.tint = 0x00FF00; } else if (hunger > 30) { hungerBarFill.tint = 0xFFFF00; } else { hungerBarFill.tint = 0xFF0000; } } if (hungerText) { hungerText.setText('Hunger: ' + hunger); // Add text bounce effect tween(hungerText, { scaleX: 1.1, scaleY: 1.1 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(hungerText, { scaleX: 1.0, scaleY: 1.0 }, { duration: 200, easing: tween.easeIn }); } }); } } function spawnFood() { if (foods.length < 4) { var food = new Food(); food.x = Math.random() * 1800 + 124; food.y = Math.random() * 1000 + 400; foods.push(food); game.addChild(food); // Start with food invisible and small food.alpha = 0; food.scaleX = 0; food.scaleY = 0; // Animate food appearing with bounce effect tween(food, { alpha: 1, scaleX: 1.3, scaleY: 1.3 }, { duration: 300, easing: tween.bounceOut, onFinish: function onFinish() { tween(food, { scaleX: 1.0, scaleY: 1.0 }, { duration: 200, easing: tween.easeOut }); } }); } } function spawnToy() { if (toys.length < 2) { var toy = new Toy(); toy.x = Math.random() * 1800 + 124; toy.y = Math.random() * 1000 + 400; toys.push(toy); game.addChild(toy); // Start with toy invisible and small toy.alpha = 0; toy.scaleX = 0; toy.scaleY = 0; // Animate toy appearing with elastic effect tween(toy, { alpha: 1, scaleX: 1.2, scaleY: 1.2 }, { duration: 400, easing: tween.elasticOut, onFinish: function onFinish() { tween(toy, { scaleX: 1.0, scaleY: 1.0 }, { duration: 300, easing: tween.easeOut }); } }); } } game.move = function (x, y, obj) { if (gameState === 'art' && isDrawing && artCanvas) { // Continue drawing on canvas if (x >= 224 && x <= 1824 && y >= 600 && y <= 1800) { var localX = x - artCanvas.x; var localY = y - artCanvas.y; artCanvas.addStroke(localX, localY); // Play brush sound occasionally while drawing if (Math.random() < 0.3) { LK.getSound('paintbrush').play(); } } } if (draggedToy) { draggedToy.x = x; draggedToy.y = y; } }; game.down = function (x, y, obj) { // Handle menu state if (gameState === 'menu') { // Check for play button click (centered at 1024, 1300) if (x >= 824 && x <= 1224 && y >= 1225 && y <= 1375) { startGame(); return; } // Check for art studio button click (centered at 1024, 1500) if (x >= 824 && x <= 1224 && y >= 1425 && y <= 1575) { startArtStudio(); return; } return; } // Handle art studio state if (gameState === 'art') { // Check back button (150, 2600) if (x >= 50 && x <= 250 && y >= 2560 && y <= 2640) { // Check if there are hidden game elements (indicating we came from gameplay) var hasHiddenGameElements = false; var gameChildren = game.children.slice(); for (var i = 0; i < gameChildren.length; i++) { if (!gameChildren[i].visible && !(gameChildren[i] instanceof Summer) && !(gameChildren[i] instanceof Heart)) { hasHiddenGameElements = true; break; } } // Clean up art studio elements for (var i = 0; i < artModeElements.length; i++) { // Don't destroy Summer if returning to gameplay if (hasHiddenGameElements && artModeElements[i] instanceof Summer) { continue; } artModeElements[i].destroy(); } artModeElements = []; artCanvas = null; colorPalette = null; artBrush = null; if (hasHiddenGameElements) { // Return to gameplay - restore UI visibility for (var i = 0; i < gameChildren.length; i++) { gameChildren[i].visible = true; } gameState = 'playing'; // Reposition Summer back to gameplay position if (summer) { summer.x = 1024; summer.y = 2200; summer.scaleX = 1.0; summer.scaleY = 1.0; } } else { // Return to menu summer = null; gameState = 'menu'; createMainMenu(); } return; } // Check clear button (400, 2600) if (x >= 300 && x <= 500 && y >= 2560 && y <= 2640) { if (artCanvas) { artCanvas.clearCanvas(); if (summer) { summer.showSpeechBubble("Fresh canvas!"); } } return; } // Check color palette clicks if (colorPalette && x >= 150 && x <= 450 && y >= 550 && y <= 750) { for (var i = 0; i < colorPalette.colorButtons.length; i++) { var colorButton = colorPalette.colorButtons[i]; var buttonX = colorPalette.x + colorButton.x; var buttonY = colorPalette.y + colorButton.y; if (x >= buttonX - 40 && x <= buttonX + 40 && y >= buttonY - 40 && y <= buttonY + 40) { if (artCanvas) { artCanvas.setColor(colorButton.colorValue); // Visual feedback - make selected color button pulse tween(colorButton, { scaleX: 1.3, scaleY: 1.3 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(colorButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 200, easing: tween.easeIn }); } }); // Change brush color to match selected color if (artBrush) { artBrush.children[0].tint = colorButton.colorValue; } if (summer) { var colorNames = ["red", "green", "blue", "magenta", "cyan", "black", "white"]; summer.showSpeechBubble("Nice " + colorNames[i] + " color!"); } } return; } } } // Check canvas drawing area if (artCanvas && x >= 224 && x <= 1824 && y >= 600 && y <= 1800) { isDrawing = true; lastDrawX = x; lastDrawY = y; var localX = x - artCanvas.x; var localY = y - artCanvas.y; artCanvas.addStroke(localX, localY); LK.getSound('paintbrush').play(); return; } return; } // Handle gameplay state if (gameState === 'playing') { // Check button clicks var buttonY = 2400; var buttonHeight = 120; var buttonWidth = 300; // Check if clicking in button area if (y >= buttonY - buttonHeight / 2 && y <= buttonY + buttonHeight / 2) { // Pet button if (x >= 300 - buttonWidth / 2 && x <= 300 + buttonWidth / 2) { // Add button press animation if (window.petButton) { tween(window.petButton, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(window.petButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.bounceOut }); } }); } summer.pet(); return; } // Feed button if (x >= 700 - buttonWidth / 2 && x <= 700 + buttonWidth / 2) { // Add button press animation if (window.feedButton) { tween(window.feedButton, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(window.feedButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.bounceOut }); } }); } // Create food next to Summer var foodToEat = new Food(); foodToEat.x = summer.x + 60; foodToEat.y = summer.y - 50; game.addChild(foodToEat); // Animate food moving to Summer's mouth and shrinking tween(foodToEat, { x: summer.x, y: summer.y - 80, scaleX: 0.3, scaleY: 0.3 }, { duration: 800, easing: tween.easeInOut, onFinish: function onFinish() { // Make food disappear with eating animation tween(foodToEat, { alpha: 0, scaleX: 0, scaleY: 0 }, { duration: 300, easing: tween.easeIn, onFinish: function onFinish() { foodToEat.destroy(); } }); } }); hunger = Math.min(100, hunger + 20); happiness = Math.min(100, happiness + 10); updateHungerBar(); updateHappinessBar(); LK.getSound('eat').play(); LK.setTimeout(function () { LK.getSound('yummy').play(); summer.showSpeechBubble("Yummy!"); }, 500); return; } // Play button if (x >= 1100 - buttonWidth / 2 && x <= 1100 + buttonWidth / 2) { // Add button press animation if (window.playButton) { tween(window.playButton, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(window.playButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.bounceOut }); } }); } happiness = Math.min(100, happiness + 15); updateHappinessBar(); LK.getSound('play').play(); // Find nearest toy to chase var nearestToy = null; var nearestDistance = Infinity; for (var i = 0; i < toys.length; i++) { var toy = toys[i]; var distance = Math.sqrt(Math.pow(summer.x - toy.x, 2) + Math.pow(summer.y - toy.y, 2)); if (distance < nearestDistance) { nearestDistance = distance; nearestToy = toy; } } // Chase the nearest toy if one exists if (nearestToy && !summer.isAnimating) { summer.isAnimating = true; // Store original position var originalX = summer.x; var originalY = summer.y; // Chase animation - move Summer towards the toy tween(summer, { x: nearestToy.x, y: nearestToy.y }, { duration: 1000, easing: tween.easeInOut, onFinish: function onFinish() { // Play animation when reaching the toy summer.playAnimation(); // Return to original position after play animation LK.setTimeout(function () { tween(summer, { x: originalX, y: originalY }, { duration: 1000, easing: tween.easeInOut, onFinish: function onFinish() { summer.isAnimating = false; } }); }, 900); // Wait for play animation to finish } }); } else { summer.playAnimation(); } return; } // Groom button if (x >= 1500 - buttonWidth / 2 && x <= 1500 + buttonWidth / 2) { // Add button press animation if (window.groomButton) { tween(window.groomButton, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(window.groomButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.bounceOut }); } }); } happiness = Math.min(100, happiness + 8); updateHappinessBar(); LK.getSound('groom').play(); summer.bounce(); summer.showSpeechBubble("So fresh!"); // Spawn grooming brush near Summer var groomBrush = new GroomBrush(); groomBrush.x = summer.x - 80; groomBrush.y = summer.y - 100; game.addChild(groomBrush); groomBrush.performGrooming(); return; } } // Check for art studio button click (centered at 1024, 2580) if (y >= 2540 && y <= 2620 && x >= 924 && x <= 1124) { // Add button press animation if (window.artStudioButton) { tween(window.artStudioButton, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(window.artStudioButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.bounceOut }); } }); } // Transition to art studio startArtStudio(); return; } // Check if clicking on a toy for (var i = 0; i < toys.length; i++) { var toy = toys[i]; var distance = Math.sqrt(Math.pow(x - toy.x, 2) + Math.pow(y - toy.y, 2)); if (distance < 50) { draggedToy = toy; break; } } } }; game.up = function (x, y, obj) { if (gameState === 'art') { isDrawing = false; if (summer && Math.random() < 0.4) { var encouragements = ["Beautiful!", "Amazing art!", "So creative!", "I love it!"]; var randomEncouragement = encouragements[Math.floor(Math.random() * encouragements.length)]; summer.showSpeechBubble(randomEncouragement); } } if (draggedToy) { draggedToy.checkPlayInteraction(); draggedToy = null; } }; game.update = function () { // Handle art studio mode if (gameState === 'art') { // Add gentle swaying animation to Summer in art mode if (summer && !summer.isAnimating && LK.ticks % 200 === 0) { tween(summer, { rotation: (Math.random() - 0.5) * 0.1 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { tween(summer, { rotation: 0 }, { duration: 1000, easing: tween.easeInOut }); } }); } // Animate art brush if (artBrush && artBrush.rotation !== undefined && LK.ticks % 120 === 0) { tween(artBrush, { rotation: artBrush.rotation + 0.2 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { if (artBrush && artBrush.rotation !== undefined) { tween(artBrush, { rotation: artBrush.rotation - 0.2 }, { duration: 500, easing: tween.easeInOut }); } } }); } return; } // Only run game logic during gameplay if (gameState === 'playing') { // Add idle breathing animation to Summer if (summer && !summer.isAnimating && LK.ticks % 180 === 0) { tween(summer, { scaleY: 1.02 }, { duration: 1000, easing: tween.easeInOut, onFinish: function onFinish() { tween(summer, { scaleY: 1.0 }, { duration: 1000, easing: tween.easeInOut }); } }); } // Update timers hungerTimer++; happinessTimer++; foodSpawnTimer++; toySpawnTimer++; // Hunger decreases every 5 seconds (300 ticks) if (hungerTimer >= 300) { hunger = Math.max(0, hunger - 1); updateHungerBar(); hungerTimer = 0; } // Happiness decreases every 10 seconds (600 ticks) or faster when hungry var happinessDecayRate = hunger < 30 ? 300 : 600; if (happinessTimer >= happinessDecayRate) { happiness = Math.max(0, happiness - 1); updateHappinessBar(); happinessTimer = 0; } // Spawn food every 30 seconds (1800 ticks) if (foodSpawnTimer >= 1800) { spawnFood(); foodSpawnTimer = 0; } // Spawn toys every 45 seconds (2700 ticks) if (toySpawnTimer >= 2700) { spawnToy(); toySpawnTimer = 0; } // Update floating hearts for (var i = hearts.length - 1; i >= 0; i--) { var heart = hearts[i]; if (heart.alpha === 1) { heart.floatUp(); } } // Check game over condition if (happiness <= 0 && hunger <= 0) { LK.showGameOver(); } } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var ArtBrush = Container.expand(function () {
var self = Container.call(this);
var brushGraphics = self.attachAsset('brush', {
anchorX: 0.5,
anchorY: 0.5
});
self.isActive = false;
self.activate = function () {
self.isActive = true;
tween(self, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 300,
easing: tween.easeOut
});
};
self.deactivate = function () {
self.isActive = false;
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 300,
easing: tween.easeIn
});
};
return self;
});
var ArtCanvas = Container.expand(function () {
var self = Container.call(this);
var canvasGraphics = self.attachAsset('canvas', {
anchorX: 0.5,
anchorY: 0.5
});
self.strokes = [];
self.currentColor = 0x000000;
self.currentStrokeAsset = 'paintStrokeBlack';
self.isDrawing = false;
self.addStroke = function (x, y) {
var stroke = self.addChild(LK.getAsset(self.currentStrokeAsset, {
anchorX: 0.5,
anchorY: 0.5
}));
stroke.x = x;
stroke.y = y;
self.strokes.push(stroke);
// Add paint splash effect
tween(stroke, {
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(stroke, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200,
easing: tween.easeIn
});
}
});
};
self.setColor = function (color) {
self.currentColor = color;
console.log("Setting color to:", color, "hex:", color.toString(16));
// Map color values to stroke assets
if (color === 0xff0000) {
self.currentStrokeAsset = 'paintStrokeRed';
} else if (color === 0x00ff00) {
self.currentStrokeAsset = 'paintStrokeGreen';
} else if (color === 0x0000ff) {
self.currentStrokeAsset = 'paintStrokeBlue';
} else if (color === 0xff00ff) {
self.currentStrokeAsset = 'paintStrokeMagenta';
} else if (color === 0x00ffff) {
self.currentStrokeAsset = 'paintStrokeCyan';
} else if (color === 0xffffff) {
self.currentStrokeAsset = 'paintStrokeWhite';
} else if (color === 0x000000) {
self.currentStrokeAsset = 'paintStrokeBlack';
} else {
self.currentStrokeAsset = 'paintStrokeBlack';
console.log("Unknown color, defaulting to black");
}
console.log("Current stroke asset set to:", self.currentStrokeAsset);
};
self.clearCanvas = function () {
for (var i = 0; i < self.strokes.length; i++) {
self.strokes[i].destroy();
}
self.strokes = [];
};
return self;
});
var ColorPalette = Container.expand(function () {
var self = Container.call(this);
self.colors = [0xff0000, 0x00ff00, 0x0000ff, 0xff00ff, 0x00ffff, 0x000000, 0xffffff];
self.colorAssets = ['colorRed', 'colorGreen', 'colorBlue', 'colorMagenta', 'colorCyan', 'colorBlack', 'colorWhite'];
self.colorButtons = [];
for (var i = 0; i < self.colors.length; i++) {
var colorButton = self.addChild(LK.getAsset(self.colorAssets[i], {
anchorX: 0.5,
anchorY: 0.5
}));
colorButton.x = i % 4 * 100;
colorButton.y = Math.floor(i / 4) * 100;
colorButton.colorValue = self.colors[i];
colorButton.assetName = self.colorAssets[i];
self.colorButtons.push(colorButton);
// Add hover effect with scale animation
colorButton.originalScale = 1.0;
colorButton.down = function (x, y, obj) {
tween(this, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 150,
easing: tween.easeOut,
onFinish: function () {
tween(this, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 150,
easing: tween.easeIn
});
}.bind(this)
});
}.bind(colorButton);
}
return self;
});
var Food = Container.expand(function () {
var self = Container.call(this);
var foodGraphics = self.attachAsset('food', {
anchorX: 0.5,
anchorY: 0.5
});
self.down = function (x, y, obj) {
self.feed();
};
self.feed = function () {
// Create food next to Summer
var foodToEat = new Food();
foodToEat.x = summer.x + 60;
foodToEat.y = summer.y - 50;
game.addChild(foodToEat);
// Animate food moving to Summer's mouth and shrinking
tween(foodToEat, {
x: summer.x,
y: summer.y - 80,
scaleX: 0.3,
scaleY: 0.3
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Make food disappear with eating animation
tween(foodToEat, {
alpha: 0,
scaleX: 0,
scaleY: 0
}, {
duration: 300,
easing: tween.easeIn,
onFinish: function onFinish() {
foodToEat.destroy();
}
});
}
});
hunger = Math.min(100, hunger + 20);
happiness = Math.min(100, happiness + 10);
updateHungerBar();
updateHappinessBar();
LK.getSound('eat').play();
LK.setTimeout(function () {
LK.getSound('yummy').play();
summer.showSpeechBubble("Yummy!");
}, 500);
// Remove from foods array
var index = foods.indexOf(self);
if (index > -1) {
foods.splice(index, 1);
}
self.destroy();
};
return self;
});
var GroomBrush = Container.expand(function () {
var self = Container.call(this);
var brushGraphics = self.attachAsset('groomBrush', {
anchorX: 0.5,
anchorY: 0.5
});
self.performGrooming = function () {
// Start grooming animation - move brush back and forth
tween(self, {
x: self.x + 50,
rotation: 0.3
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self, {
x: self.x - 100,
rotation: -0.3
}, {
duration: 400,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self, {
x: self.x + 50,
rotation: 0,
alpha: 0,
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 500,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
}
});
}
});
};
return self;
});
var Heart = Container.expand(function () {
var self = Container.call(this);
var heartGraphics = self.attachAsset('heart', {
anchorX: 0.5,
anchorY: 0.5
});
self.floatUp = function () {
tween(self, {
y: self.y - 150,
alpha: 0
}, {
duration: 1500,
easing: tween.easeOut,
onFinish: function onFinish() {
var index = hearts.indexOf(self);
if (index > -1) {
hearts.splice(index, 1);
}
self.destroy();
}
});
};
return self;
});
var Summer = Container.expand(function () {
var self = Container.call(this);
var summerGraphics = self.attachAsset('summer', {
anchorX: 0.5,
anchorY: 1.0
});
self.originalScale = 1.0;
self.isAnimating = false;
self.down = function (x, y, obj) {
if (!self.isAnimating) {
self.pet();
}
};
self.pet = function () {
happiness = Math.min(100, happiness + 5);
updateHappinessBar();
LK.getSound('bark').play();
self.createHeart();
self.bounce();
self.showSpeechBubble("Woof!");
};
self.createHeart = function () {
var heart = new Heart();
heart.x = self.x + (Math.random() - 0.5) * 100;
heart.y = self.y - 50;
game.addChild(heart);
hearts.push(heart);
};
self.bounce = function () {
if (self.isAnimating) return;
self.isAnimating = true;
tween(self, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self, {
scaleX: self.originalScale,
scaleY: self.originalScale
}, {
duration: 200,
easing: tween.easeIn,
onFinish: function onFinish() {
self.isAnimating = false;
}
});
}
});
};
self.playAnimation = function () {
if (self.isAnimating) return;
self.isAnimating = true;
tween(self, {
rotation: 0.2
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self, {
rotation: -0.2
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self, {
rotation: 0
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.isAnimating = false;
}
});
}
});
}
});
};
self.showSpeechBubble = function (text) {
var speechBubble = new Text2(text, {
size: 40,
fill: 0x000000
});
speechBubble.anchor.set(0.5, 1);
speechBubble.x = self.x;
speechBubble.y = self.y - summerGraphics.height / 2 - 20; // Position above Summer's head
game.addChild(speechBubble);
tween(speechBubble, {
alpha: 0,
y: speechBubble.y - 50
}, {
duration: 1500,
easing: tween.easeOut,
onFinish: function onFinish() {
speechBubble.destroy();
}
});
};
return self;
});
var Toy = Container.expand(function () {
var self = Container.call(this);
var toyGraphics = self.attachAsset('toy', {
anchorX: 0.5,
anchorY: 0.5
});
self.isDragging = false;
self.down = function (x, y, obj) {
self.isDragging = true;
self.startDragX = x;
self.startDragY = y;
};
self.checkPlayInteraction = function () {
var distance = Math.sqrt(Math.pow(self.x - summer.x, 2) + Math.pow(self.y - summer.y, 2));
if (distance < 150) {
happiness = Math.min(100, happiness + 15);
updateHappinessBar();
LK.getSound('play').play();
summer.playAnimation();
summer.showSpeechBubble("Zoomies!");
// Remove from toys array
var index = toys.indexOf(self);
if (index > -1) {
toys.splice(index, 1);
}
self.destroy();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xFFB6C1
});
/****
* Game Code
****/
// Add Array.find polyfill for compatibility
if (!Array.prototype.find) {
Array.prototype.find = function (predicate) {
if (this === null) {
throw new TypeError('Array.prototype.find called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = parseInt(list.length) || 0;
var thisArg = arguments[1];
var value;
for (var i = 0; i < length; i++) {
value = list[i];
if (predicate.call(thisArg, value, i, list)) {
return value;
}
}
return undefined;
};
}
var gameState = 'splash'; // 'splash', 'menu', 'playing', or 'art'
var menuSummer = null;
var gamePlayElements = [];
var happiness = 100;
var hunger = 100;
var foods = [];
var toys = [];
var hearts = [];
var draggedToy = null;
var summer = null;
var happinessBarFill = null;
var hungerBarFill = null;
var happinessText = null;
var hungerText = null;
// Art studio mode variables
var artCanvas = null;
var colorPalette = null;
var artBrush = null;
var artModeElements = [];
var isDrawing = false;
var lastDrawX = 0;
var lastDrawY = 0;
// Create splash screen
function createSplashScreen() {
// Black background already set in game initialization
game.setBackgroundColor(0x000000);
// Create logo
var logo = game.addChild(LK.getAsset('summerLogo', {
anchorX: 0.5,
anchorY: 0.5
}));
logo.x = 1024;
logo.y = 1200;
// Create text
var splashText = new Text2('Summer Productions Presents', {
size: 80,
fill: 0xFFFFFF
});
splashText.anchor.set(0.5, 0.5);
splashText.x = 1024;
splashText.y = 1500;
game.addChild(splashText);
// Fade in animation
logo.alpha = 0;
splashText.alpha = 0;
tween(logo, {
alpha: 1
}, {
duration: 1000,
easing: tween.easeInOut
});
tween(splashText, {
alpha: 1
}, {
duration: 1000,
easing: tween.easeInOut
});
// Music will start when transitioning to menu
// After 4 seconds, transition to main menu
LK.setTimeout(function () {
// Fade out splash screen
tween(logo, {
alpha: 0
}, {
duration: 500,
easing: tween.easeInOut
});
tween(splashText, {
alpha: 0
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
logo.destroy();
splashText.destroy();
gameState = 'menu';
game.setBackgroundColor(0xFFB6C1);
// Start music when transitioning to menu
LK.playMusic('bgmusic', {
loop: true
});
createMainMenu();
}
});
}, 4000);
}
// Create main menu
function createMainMenu() {
// Music will start when title flies in
// Game title - start off screen
var titleText = new Text2('RAISE A SUMMER', {
size: 120,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = -500; // Start off screen left
titleText.y = 800;
game.addChild(titleText);
// Fly in animation
tween(titleText, {
x: 1024
}, {
duration: 1500,
easing: tween.easeOut
});
// Music already started during splash screen
// Add pulsing animation to title
function animateTitle() {
tween(titleText, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(titleText, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (gameState === 'menu') {
animateTitle();
}
}
});
}
});
}
animateTitle();
// Play button
var menuPlayButton = game.addChild(LK.getAsset('barBackground', {
anchorX: 0.5,
anchorY: 0.5
}));
menuPlayButton.width = 400;
menuPlayButton.height = 150;
menuPlayButton.x = 1024;
menuPlayButton.y = 1300;
menuPlayButton.tint = 0x32CD32;
var menuPlayButtonText = new Text2('PLAY', {
size: 80,
fill: 0xFFFFFF
});
menuPlayButtonText.anchor.set(0.5, 0.5);
menuPlayButtonText.x = menuPlayButton.x;
menuPlayButtonText.y = menuPlayButton.y;
game.addChild(menuPlayButtonText);
// Art Studio button
var menuArtButton = game.addChild(LK.getAsset('barBackground', {
anchorX: 0.5,
anchorY: 0.5
}));
menuArtButton.width = 400;
menuArtButton.height = 150;
menuArtButton.x = 1024;
menuArtButton.y = 1500;
menuArtButton.tint = 0x9370DB;
var menuArtButtonText = new Text2('ART STUDIO', {
size: 70,
fill: 0xFFFFFF
});
menuArtButtonText.anchor.set(0.5, 0.5);
menuArtButtonText.x = menuArtButton.x;
menuArtButtonText.y = menuArtButton.y;
game.addChild(menuArtButtonText);
// Add bouncing animation to menu play button
function animateMenuPlayButton() {
tween(menuPlayButton, {
y: menuPlayButton.y - 20
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(menuPlayButton, {
y: menuPlayButton.y + 20
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (gameState === 'menu') {
animateMenuPlayButton();
}
}
});
}
});
tween(menuPlayButtonText, {
y: menuPlayButtonText.y - 20
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(menuPlayButtonText, {
y: menuPlayButtonText.y + 20
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (gameState === 'menu') {
animateMenuPlayButton();
}
}
});
}
});
}
animateMenuPlayButton();
// Add subtitle
var subtitleText = new Text2('Your Virtual Pet Companion', {
size: 60,
fill: 0xFFB6C1
});
subtitleText.anchor.set(0.5, 0.5);
subtitleText.x = 1024;
subtitleText.y = 950;
subtitleText.alpha = 0;
game.addChild(subtitleText);
// Fade in subtitle after a delay
LK.setTimeout(function () {
if (gameState === 'menu') {
tween(subtitleText, {
alpha: 1
}, {
duration: 1500,
easing: tween.easeInOut
});
}
}, 1000);
// Create ten floating Summer characters in background
var floatingSummers = [];
for (var s = 0; s < 10; s++) {
var floatingSummer = game.addChild(new Summer());
floatingSummer.x = Math.random() * 2048;
floatingSummer.y = Math.random() * 2732;
floatingSummer.alpha = 0.6; // Make them semi-transparent
floatingSummer.scaleX = 0.7; // Make them smaller
floatingSummer.scaleY = 0.7;
floatingSummers.push(floatingSummer);
// Start individual floating animation for each Summer
startIndividualFloatingAnimation(floatingSummer);
}
// Store the main menu Summer (keeping original behavior)
menuSummer = floatingSummers[0];
// Make the first one more prominent
menuSummer.alpha = 1.0;
menuSummer.scaleX = 1.0;
menuSummer.scaleY = 1.0;
// Add floating food decorations
var decorativeItems = [];
var _loop = function _loop() {
decorativeFood = game.addChild(LK.getAsset('food', {
anchorX: 0.5,
anchorY: 0.5
}));
decorativeFood.x = Math.random() * 2048;
decorativeFood.y = Math.random() * 2732;
decorativeFood.alpha = 0.3;
decorativeFood.scaleX = 0.5;
decorativeFood.scaleY = 0.5;
decorativeItems.push(decorativeFood);
// Float around randomly
function floatDecoration(item) {
tween(item, {
x: Math.random() * 2048,
y: Math.random() * 2732,
rotation: item.rotation + (Math.random() - 0.5) * Math.PI
}, {
duration: 5000 + Math.random() * 3000,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (gameState === 'menu') {
floatDecoration(item);
}
}
});
}
floatDecoration(decorativeFood);
},
decorativeFood;
for (var i = 0; i < 8; i++) {
_loop();
}
// Add bouncing animation to art studio button
function animateMenuArtButton() {
tween(menuArtButton, {
y: menuArtButton.y - 15
}, {
duration: 1200,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(menuArtButton, {
y: menuArtButton.y + 15
}, {
duration: 1200,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (gameState === 'menu') {
animateMenuArtButton();
}
}
});
}
});
tween(menuArtButtonText, {
y: menuArtButtonText.y - 15
}, {
duration: 1200,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(menuArtButtonText, {
y: menuArtButtonText.y + 15
}, {
duration: 1200,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (gameState === 'menu') {
animateMenuArtButton();
}
}
});
}
});
}
animateMenuArtButton();
// Store menu elements for cleanup
gamePlayElements = [titleText, subtitleText, menuPlayButton, menuPlayButtonText, menuArtButton, menuArtButtonText].concat(decorativeItems);
}
function startFloatingAnimation() {
if (!menuSummer) return;
// Random floating movement - use full screen dimensions with boundaries
// Screen is 2048x2732, leave margin for Summer's size (200px)
var margin = 100;
var targetX = margin + Math.random() * (2048 - 2 * margin);
var targetY = margin + Math.random() * (2732 - 2 * margin);
tween(menuSummer, {
x: targetX,
y: targetY,
rotation: (Math.random() - 0.5) * 0.5
}, {
duration: 3000 + Math.random() * 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Do a flip
if (!menuSummer) return;
tween(menuSummer, {
rotation: menuSummer.rotation + Math.PI * 2
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Continue floating
startFloatingAnimation();
}
});
}
});
// Spawn floating hearts around Summer
if (Math.random() < 0.3) {
var menuHeart = new Heart();
menuHeart.x = menuSummer.x + (Math.random() - 0.5) * 150;
menuHeart.y = menuSummer.y + (Math.random() - 0.5) * 150;
game.addChild(menuHeart);
menuHeart.floatUp();
}
}
function startIndividualFloatingAnimation(summerChar) {
if (!summerChar || gameState !== 'menu') return;
// Random floating movement - use full screen dimensions with boundaries
// Screen is 2048x2732, leave margin for Summer's size (200px)
var margin = 100;
var targetX = margin + Math.random() * (2048 - 2 * margin);
var targetY = margin + Math.random() * (2732 - 2 * margin);
tween(summerChar, {
x: targetX,
y: targetY,
rotation: (Math.random() - 0.5) * 0.5
}, {
duration: 4000 + Math.random() * 3000,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Do a gentle rotation
if (!summerChar || gameState !== 'menu') return;
tween(summerChar, {
rotation: summerChar.rotation + (Math.random() - 0.5) * Math.PI
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Continue floating
startIndividualFloatingAnimation(summerChar);
}
});
}
});
// Occasionally spawn floating hearts around this Summer
if (Math.random() < 0.2) {
var menuHeart = new Heart();
menuHeart.x = summerChar.x + (Math.random() - 0.5) * 150;
menuHeart.y = summerChar.y + (Math.random() - 0.5) * 150;
game.addChild(menuHeart);
menuHeart.floatUp();
}
}
function startArtStudio() {
// Store previous game state
var previousState = gameState;
// Remove menu elements if coming from menu
if (previousState === 'menu') {
for (var i = 0; i < gamePlayElements.length; i++) {
gamePlayElements[i].destroy();
}
gamePlayElements = [];
// Remove all floating summers
if (menuSummer) {
var children = game.children.slice();
for (var i = 0; i < children.length; i++) {
if (children[i] instanceof Summer) {
children[i].destroy();
}
}
menuSummer = null;
}
}
// If coming from gameplay, hide game UI elements but preserve Summer
if (previousState === 'playing') {
// Hide UI elements but don't destroy them
var gameChildren = game.children.slice();
for (var i = 0; i < gameChildren.length; i++) {
var child = gameChildren[i];
// Hide everything except Summer and hearts
if (!(child instanceof Summer) && !(child instanceof Heart)) {
child.visible = false;
}
}
}
// Create art studio elements
createArtStudio();
gameState = 'art';
}
function createArtStudio() {
// Create title
var artTitle = new Text2('ART STUDIO', {
size: 100,
fill: 0x4B0082
});
artTitle.anchor.set(0.5, 0.5);
artTitle.x = 1024;
artTitle.y = 200;
game.addChild(artTitle);
artModeElements.push(artTitle);
// Create canvas
artCanvas = game.addChild(new ArtCanvas());
artCanvas.x = 1024;
artCanvas.y = 1200;
artModeElements.push(artCanvas);
// Create color palette
colorPalette = game.addChild(new ColorPalette());
colorPalette.x = 200;
colorPalette.y = 600;
artModeElements.push(colorPalette);
// Create brush
artBrush = game.addChild(new ArtBrush());
if (artBrush) {
artBrush.x = 200;
artBrush.y = 400;
artBrush.activate();
artModeElements.push(artBrush);
}
// Create or reposition Summer in art mode
if (!summer) {
summer = game.addChild(new Summer());
artModeElements.push(summer);
}
summer.x = 1800;
summer.y = 800;
summer.scaleX = 0.8;
summer.scaleY = 0.8;
summer.visible = true;
// Ensure Summer appears in front of canvas
game.removeChild(summer);
game.addChild(summer);
// Add art studio buttons
var backButton = game.addChild(LK.getAsset('barBackground', {
anchorX: 0.5,
anchorY: 0.5
}));
backButton.width = 200;
backButton.height = 80;
backButton.x = 150;
backButton.y = 2600;
backButton.tint = 0x808080;
artModeElements.push(backButton);
var backButtonText = new Text2('BACK', {
size: 40,
fill: 0xFFFFFF
});
backButtonText.anchor.set(0.5, 0.5);
backButtonText.x = backButton.x;
backButtonText.y = backButton.y;
game.addChild(backButtonText);
artModeElements.push(backButtonText);
var clearButton = game.addChild(LK.getAsset('barBackground', {
anchorX: 0.5,
anchorY: 0.5
}));
clearButton.width = 200;
clearButton.height = 80;
clearButton.x = 400;
clearButton.y = 2600;
clearButton.tint = 0xff4444;
artModeElements.push(clearButton);
var clearButtonText = new Text2('CLEAR', {
size: 40,
fill: 0xFFFFFF
});
clearButtonText.anchor.set(0.5, 0.5);
clearButtonText.x = clearButton.x;
clearButtonText.y = clearButton.y;
game.addChild(clearButtonText);
artModeElements.push(clearButtonText);
// Add instructions
var instructions = new Text2('Tap colors to change brush, draw on canvas!', {
size: 45,
fill: 0x333333
});
instructions.anchor.set(0.5, 0.5);
instructions.x = 1024;
instructions.y = 2650;
game.addChild(instructions);
artModeElements.push(instructions);
}
function startGame() {
// Music already playing - no transition needed
// Remove menu elements
for (var i = 0; i < gamePlayElements.length; i++) {
gamePlayElements[i].destroy();
}
gamePlayElements = [];
// Remove all floating summers
if (menuSummer) {
// Find and destroy all Summer instances in the game
var children = game.children.slice(); // Create a copy to iterate safely
for (var i = 0; i < children.length; i++) {
if (children[i] instanceof Summer) {
children[i].destroy();
}
}
menuSummer = null;
}
// Create game Summer
summer = game.addChild(new Summer());
summer.x = 1024;
summer.y = 2200;
// Create game UI and elements
createGameUI();
gameState = 'playing';
}
function createGameUI() {
// Create UI bars
var happinessBarBg = game.addChild(LK.getAsset('barBackground', {
anchorX: 0,
anchorY: 0
}));
happinessBarBg.x = 200;
happinessBarBg.y = 150;
happinessBarFill = game.addChild(LK.getAsset('happinessBar', {
anchorX: 0,
anchorY: 0
}));
happinessBarFill.x = 200;
happinessBarFill.y = 150;
var hungerBarBg = game.addChild(LK.getAsset('barBackground', {
anchorX: 0,
anchorY: 0
}));
hungerBarBg.x = 200;
hungerBarBg.y = 250;
hungerBarFill = game.addChild(LK.getAsset('hungerBar', {
anchorX: 0,
anchorY: 0
}));
hungerBarFill.x = 200;
hungerBarFill.y = 250;
// Create UI text
happinessText = new Text2('Happiness: 100', {
size: 50,
fill: 0x000000
});
happinessText.anchor.set(0, 0.5);
happinessText.x = 650;
happinessText.y = 170;
game.addChild(happinessText);
hungerText = new Text2('Hunger: 100', {
size: 50,
fill: 0x000000
});
hungerText.anchor.set(0, 0.5);
hungerText.x = 650;
hungerText.y = 270;
game.addChild(hungerText);
var instructionText = new Text2('Use buttons below to care for Summer!', {
size: 40,
fill: 0x333333
});
instructionText.anchor.set(0.5, 1);
instructionText.x = 1024;
instructionText.y = 2680;
game.addChild(instructionText);
// Create command buttons
var buttonWidth = 300;
var buttonHeight = 120;
var buttonY = 2400;
var buttonSpacing = 400;
// Store button references globally
window.petButton = null;
window.feedButton = null;
window.playButton = null;
window.groomButton = null;
// Pet button
var petButton = game.addChild(LK.getAsset('barBackground', {
anchorX: 0.5,
anchorY: 0.5
}));
petButton.width = buttonWidth;
petButton.height = buttonHeight;
petButton.x = 300;
petButton.y = buttonY;
petButton.tint = 0xFF69B4;
window.petButton = petButton;
// Add gentle pulsing animation to pet button
function animatePetButton() {
tween(petButton, {
scaleX: 1.05,
scaleY: 1.05
}, {
duration: 1500,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(petButton, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 1500,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (gameState === 'playing') {
animatePetButton();
}
}
});
}
});
}
animatePetButton();
var petButtonText = new Text2('PET', {
size: 50,
fill: 0xFFFFFF
});
petButtonText.anchor.set(0.5, 0.5);
petButtonText.x = petButton.x;
petButtonText.y = petButton.y;
game.addChild(petButtonText);
// Feed button
var feedButton = game.addChild(LK.getAsset('barBackground', {
anchorX: 0.5,
anchorY: 0.5
}));
feedButton.width = buttonWidth;
feedButton.height = buttonHeight;
feedButton.x = 700;
feedButton.y = buttonY;
feedButton.tint = 0x32CD32;
window.feedButton = feedButton;
// Add floating animation to feed button
function animateFeedButton() {
tween(feedButton, {
y: buttonY - 10,
rotation: 0.05
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(feedButton, {
y: buttonY,
rotation: -0.05
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (gameState === 'playing') {
animateFeedButton();
}
}
});
}
});
}
animateFeedButton();
var feedButtonText = new Text2('FEED', {
size: 50,
fill: 0xFFFFFF
});
feedButtonText.anchor.set(0.5, 0.5);
feedButtonText.x = feedButton.x;
feedButtonText.y = feedButton.y;
game.addChild(feedButtonText);
// Play button
var playButton = game.addChild(LK.getAsset('barBackground', {
anchorX: 0.5,
anchorY: 0.5
}));
playButton.width = buttonWidth;
playButton.height = buttonHeight;
playButton.x = 1100;
playButton.y = buttonY;
playButton.tint = 0x4169E1;
window.playButton = playButton;
var playButtonText = new Text2('PLAY', {
size: 50,
fill: 0xFFFFFF
});
playButtonText.anchor.set(0.5, 0.5);
playButtonText.x = playButton.x;
playButtonText.y = playButton.y;
game.addChild(playButtonText);
// Groom button
var groomButton = game.addChild(LK.getAsset('barBackground', {
anchorX: 0.5,
anchorY: 0.5
}));
groomButton.width = buttonWidth;
groomButton.height = buttonHeight;
groomButton.x = 1500;
groomButton.y = buttonY;
groomButton.tint = 0x9370DB;
window.groomButton = groomButton;
// Add wobble animation to play button
var _animatePlayButton = function animatePlayButton() {
tween(playButton, {
rotation: 0.1,
scaleX: 1.02,
scaleY: 1.02
}, {
duration: 1200,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(playButton, {
rotation: -0.1,
scaleX: 0.98,
scaleY: 0.98
}, {
duration: 1200,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (gameState === 'playing') {
_animatePlayButton();
}
}
});
}
});
};
_animatePlayButton();
var groomButtonText = new Text2('GROOM', {
size: 50,
fill: 0xFFFFFF
});
groomButtonText.anchor.set(0.5, 0.5);
groomButtonText.x = groomButton.x;
groomButtonText.y = groomButton.y;
game.addChild(groomButtonText);
// Add gentle shake animation to groom button
function animateGroomButton() {
tween(groomButton, {
x: 1500 + 5,
rotation: 0.08
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(groomButton, {
x: 1500 - 5,
rotation: -0.08
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(groomButton, {
x: 1500,
rotation: 0
}, {
duration: 400,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (gameState === 'playing') {
LK.setTimeout(function () {
animateGroomButton();
}, 2000);
}
}
});
}
});
}
});
}
animateGroomButton();
// Art Studio button
var artStudioButton = game.addChild(LK.getAsset('barBackground', {
anchorX: 0.5,
anchorY: 0.5
}));
artStudioButton.width = 200;
artStudioButton.height = 80;
artStudioButton.x = 1024;
artStudioButton.y = 2580;
artStudioButton.tint = 0x9370DB;
window.artStudioButton = artStudioButton;
var artStudioButtonText = new Text2('ART', {
size: 40,
fill: 0xFFFFFF
});
artStudioButtonText.anchor.set(0.5, 0.5);
artStudioButtonText.x = artStudioButton.x;
artStudioButtonText.y = artStudioButton.y;
game.addChild(artStudioButtonText);
// Add floating animation to art studio button
function animateArtStudioButton() {
tween(artStudioButton, {
y: 2570,
scaleX: 1.05,
scaleY: 1.05
}, {
duration: 1400,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(artStudioButton, {
y: 2580,
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 1400,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (gameState === 'playing') {
animateArtStudioButton();
}
}
});
}
});
tween(artStudioButtonText, {
y: 2570
}, {
duration: 1400,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(artStudioButtonText, {
y: 2580
}, {
duration: 1400,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (gameState === 'playing') {
animateArtStudioButton();
}
}
});
}
});
}
animateArtStudioButton();
// Initial spawn
spawnFood();
spawnToy();
}
// Timers
var hungerTimer = 0;
var happinessTimer = 0;
var foodSpawnTimer = 0;
var toySpawnTimer = 0;
// Initialize splash screen
createSplashScreen();
// Background music already playing
function updateHappinessBar() {
var percentage = happiness / 100;
if (happinessBarFill) {
// Stop any existing tween on the bar
tween.stop(happinessBarFill, {
width: true
});
// Animate the bar width change
tween(happinessBarFill, {
width: 400 * percentage
}, {
duration: 500,
easing: tween.easeOut
});
// Add a brief pulse effect
tween(happinessBarFill, {
scaleY: 1.2
}, {
duration: 150,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(happinessBarFill, {
scaleY: 1.0
}, {
duration: 150,
easing: tween.easeIn
});
}
});
if (happiness > 60) {
happinessBarFill.tint = 0x00FF00;
} else if (happiness > 30) {
happinessBarFill.tint = 0xFFFF00;
} else {
happinessBarFill.tint = 0xFF0000;
}
}
if (happinessText) {
happinessText.setText('Happiness: ' + happiness);
// Add text bounce effect
tween(happinessText, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(happinessText, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200,
easing: tween.easeIn
});
}
});
}
}
function updateHungerBar() {
var percentage = hunger / 100;
if (hungerBarFill) {
// Stop any existing tween on the bar
tween.stop(hungerBarFill, {
width: true
});
// Animate the bar width change
tween(hungerBarFill, {
width: 400 * percentage
}, {
duration: 500,
easing: tween.easeOut
});
// Add a brief pulse effect
tween(hungerBarFill, {
scaleY: 1.2
}, {
duration: 150,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(hungerBarFill, {
scaleY: 1.0
}, {
duration: 150,
easing: tween.easeIn
});
}
});
if (hunger > 60) {
hungerBarFill.tint = 0x00FF00;
} else if (hunger > 30) {
hungerBarFill.tint = 0xFFFF00;
} else {
hungerBarFill.tint = 0xFF0000;
}
}
if (hungerText) {
hungerText.setText('Hunger: ' + hunger);
// Add text bounce effect
tween(hungerText, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(hungerText, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200,
easing: tween.easeIn
});
}
});
}
}
function spawnFood() {
if (foods.length < 4) {
var food = new Food();
food.x = Math.random() * 1800 + 124;
food.y = Math.random() * 1000 + 400;
foods.push(food);
game.addChild(food);
// Start with food invisible and small
food.alpha = 0;
food.scaleX = 0;
food.scaleY = 0;
// Animate food appearing with bounce effect
tween(food, {
alpha: 1,
scaleX: 1.3,
scaleY: 1.3
}, {
duration: 300,
easing: tween.bounceOut,
onFinish: function onFinish() {
tween(food, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200,
easing: tween.easeOut
});
}
});
}
}
function spawnToy() {
if (toys.length < 2) {
var toy = new Toy();
toy.x = Math.random() * 1800 + 124;
toy.y = Math.random() * 1000 + 400;
toys.push(toy);
game.addChild(toy);
// Start with toy invisible and small
toy.alpha = 0;
toy.scaleX = 0;
toy.scaleY = 0;
// Animate toy appearing with elastic effect
tween(toy, {
alpha: 1,
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 400,
easing: tween.elasticOut,
onFinish: function onFinish() {
tween(toy, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 300,
easing: tween.easeOut
});
}
});
}
}
game.move = function (x, y, obj) {
if (gameState === 'art' && isDrawing && artCanvas) {
// Continue drawing on canvas
if (x >= 224 && x <= 1824 && y >= 600 && y <= 1800) {
var localX = x - artCanvas.x;
var localY = y - artCanvas.y;
artCanvas.addStroke(localX, localY);
// Play brush sound occasionally while drawing
if (Math.random() < 0.3) {
LK.getSound('paintbrush').play();
}
}
}
if (draggedToy) {
draggedToy.x = x;
draggedToy.y = y;
}
};
game.down = function (x, y, obj) {
// Handle menu state
if (gameState === 'menu') {
// Check for play button click (centered at 1024, 1300)
if (x >= 824 && x <= 1224 && y >= 1225 && y <= 1375) {
startGame();
return;
}
// Check for art studio button click (centered at 1024, 1500)
if (x >= 824 && x <= 1224 && y >= 1425 && y <= 1575) {
startArtStudio();
return;
}
return;
}
// Handle art studio state
if (gameState === 'art') {
// Check back button (150, 2600)
if (x >= 50 && x <= 250 && y >= 2560 && y <= 2640) {
// Check if there are hidden game elements (indicating we came from gameplay)
var hasHiddenGameElements = false;
var gameChildren = game.children.slice();
for (var i = 0; i < gameChildren.length; i++) {
if (!gameChildren[i].visible && !(gameChildren[i] instanceof Summer) && !(gameChildren[i] instanceof Heart)) {
hasHiddenGameElements = true;
break;
}
}
// Clean up art studio elements
for (var i = 0; i < artModeElements.length; i++) {
// Don't destroy Summer if returning to gameplay
if (hasHiddenGameElements && artModeElements[i] instanceof Summer) {
continue;
}
artModeElements[i].destroy();
}
artModeElements = [];
artCanvas = null;
colorPalette = null;
artBrush = null;
if (hasHiddenGameElements) {
// Return to gameplay - restore UI visibility
for (var i = 0; i < gameChildren.length; i++) {
gameChildren[i].visible = true;
}
gameState = 'playing';
// Reposition Summer back to gameplay position
if (summer) {
summer.x = 1024;
summer.y = 2200;
summer.scaleX = 1.0;
summer.scaleY = 1.0;
}
} else {
// Return to menu
summer = null;
gameState = 'menu';
createMainMenu();
}
return;
}
// Check clear button (400, 2600)
if (x >= 300 && x <= 500 && y >= 2560 && y <= 2640) {
if (artCanvas) {
artCanvas.clearCanvas();
if (summer) {
summer.showSpeechBubble("Fresh canvas!");
}
}
return;
}
// Check color palette clicks
if (colorPalette && x >= 150 && x <= 450 && y >= 550 && y <= 750) {
for (var i = 0; i < colorPalette.colorButtons.length; i++) {
var colorButton = colorPalette.colorButtons[i];
var buttonX = colorPalette.x + colorButton.x;
var buttonY = colorPalette.y + colorButton.y;
if (x >= buttonX - 40 && x <= buttonX + 40 && y >= buttonY - 40 && y <= buttonY + 40) {
if (artCanvas) {
artCanvas.setColor(colorButton.colorValue);
// Visual feedback - make selected color button pulse
tween(colorButton, {
scaleX: 1.3,
scaleY: 1.3
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(colorButton, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200,
easing: tween.easeIn
});
}
});
// Change brush color to match selected color
if (artBrush) {
artBrush.children[0].tint = colorButton.colorValue;
}
if (summer) {
var colorNames = ["red", "green", "blue", "magenta", "cyan", "black", "white"];
summer.showSpeechBubble("Nice " + colorNames[i] + " color!");
}
}
return;
}
}
}
// Check canvas drawing area
if (artCanvas && x >= 224 && x <= 1824 && y >= 600 && y <= 1800) {
isDrawing = true;
lastDrawX = x;
lastDrawY = y;
var localX = x - artCanvas.x;
var localY = y - artCanvas.y;
artCanvas.addStroke(localX, localY);
LK.getSound('paintbrush').play();
return;
}
return;
}
// Handle gameplay state
if (gameState === 'playing') {
// Check button clicks
var buttonY = 2400;
var buttonHeight = 120;
var buttonWidth = 300;
// Check if clicking in button area
if (y >= buttonY - buttonHeight / 2 && y <= buttonY + buttonHeight / 2) {
// Pet button
if (x >= 300 - buttonWidth / 2 && x <= 300 + buttonWidth / 2) {
// Add button press animation
if (window.petButton) {
tween(window.petButton, {
scaleX: 0.95,
scaleY: 0.95
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(window.petButton, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.bounceOut
});
}
});
}
summer.pet();
return;
}
// Feed button
if (x >= 700 - buttonWidth / 2 && x <= 700 + buttonWidth / 2) {
// Add button press animation
if (window.feedButton) {
tween(window.feedButton, {
scaleX: 0.95,
scaleY: 0.95
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(window.feedButton, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.bounceOut
});
}
});
}
// Create food next to Summer
var foodToEat = new Food();
foodToEat.x = summer.x + 60;
foodToEat.y = summer.y - 50;
game.addChild(foodToEat);
// Animate food moving to Summer's mouth and shrinking
tween(foodToEat, {
x: summer.x,
y: summer.y - 80,
scaleX: 0.3,
scaleY: 0.3
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Make food disappear with eating animation
tween(foodToEat, {
alpha: 0,
scaleX: 0,
scaleY: 0
}, {
duration: 300,
easing: tween.easeIn,
onFinish: function onFinish() {
foodToEat.destroy();
}
});
}
});
hunger = Math.min(100, hunger + 20);
happiness = Math.min(100, happiness + 10);
updateHungerBar();
updateHappinessBar();
LK.getSound('eat').play();
LK.setTimeout(function () {
LK.getSound('yummy').play();
summer.showSpeechBubble("Yummy!");
}, 500);
return;
}
// Play button
if (x >= 1100 - buttonWidth / 2 && x <= 1100 + buttonWidth / 2) {
// Add button press animation
if (window.playButton) {
tween(window.playButton, {
scaleX: 0.95,
scaleY: 0.95
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(window.playButton, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.bounceOut
});
}
});
}
happiness = Math.min(100, happiness + 15);
updateHappinessBar();
LK.getSound('play').play();
// Find nearest toy to chase
var nearestToy = null;
var nearestDistance = Infinity;
for (var i = 0; i < toys.length; i++) {
var toy = toys[i];
var distance = Math.sqrt(Math.pow(summer.x - toy.x, 2) + Math.pow(summer.y - toy.y, 2));
if (distance < nearestDistance) {
nearestDistance = distance;
nearestToy = toy;
}
}
// Chase the nearest toy if one exists
if (nearestToy && !summer.isAnimating) {
summer.isAnimating = true;
// Store original position
var originalX = summer.x;
var originalY = summer.y;
// Chase animation - move Summer towards the toy
tween(summer, {
x: nearestToy.x,
y: nearestToy.y
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Play animation when reaching the toy
summer.playAnimation();
// Return to original position after play animation
LK.setTimeout(function () {
tween(summer, {
x: originalX,
y: originalY
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
summer.isAnimating = false;
}
});
}, 900); // Wait for play animation to finish
}
});
} else {
summer.playAnimation();
}
return;
}
// Groom button
if (x >= 1500 - buttonWidth / 2 && x <= 1500 + buttonWidth / 2) {
// Add button press animation
if (window.groomButton) {
tween(window.groomButton, {
scaleX: 0.95,
scaleY: 0.95
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(window.groomButton, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.bounceOut
});
}
});
}
happiness = Math.min(100, happiness + 8);
updateHappinessBar();
LK.getSound('groom').play();
summer.bounce();
summer.showSpeechBubble("So fresh!");
// Spawn grooming brush near Summer
var groomBrush = new GroomBrush();
groomBrush.x = summer.x - 80;
groomBrush.y = summer.y - 100;
game.addChild(groomBrush);
groomBrush.performGrooming();
return;
}
}
// Check for art studio button click (centered at 1024, 2580)
if (y >= 2540 && y <= 2620 && x >= 924 && x <= 1124) {
// Add button press animation
if (window.artStudioButton) {
tween(window.artStudioButton, {
scaleX: 0.95,
scaleY: 0.95
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(window.artStudioButton, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.bounceOut
});
}
});
}
// Transition to art studio
startArtStudio();
return;
}
// Check if clicking on a toy
for (var i = 0; i < toys.length; i++) {
var toy = toys[i];
var distance = Math.sqrt(Math.pow(x - toy.x, 2) + Math.pow(y - toy.y, 2));
if (distance < 50) {
draggedToy = toy;
break;
}
}
}
};
game.up = function (x, y, obj) {
if (gameState === 'art') {
isDrawing = false;
if (summer && Math.random() < 0.4) {
var encouragements = ["Beautiful!", "Amazing art!", "So creative!", "I love it!"];
var randomEncouragement = encouragements[Math.floor(Math.random() * encouragements.length)];
summer.showSpeechBubble(randomEncouragement);
}
}
if (draggedToy) {
draggedToy.checkPlayInteraction();
draggedToy = null;
}
};
game.update = function () {
// Handle art studio mode
if (gameState === 'art') {
// Add gentle swaying animation to Summer in art mode
if (summer && !summer.isAnimating && LK.ticks % 200 === 0) {
tween(summer, {
rotation: (Math.random() - 0.5) * 0.1
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(summer, {
rotation: 0
}, {
duration: 1000,
easing: tween.easeInOut
});
}
});
}
// Animate art brush
if (artBrush && artBrush.rotation !== undefined && LK.ticks % 120 === 0) {
tween(artBrush, {
rotation: artBrush.rotation + 0.2
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (artBrush && artBrush.rotation !== undefined) {
tween(artBrush, {
rotation: artBrush.rotation - 0.2
}, {
duration: 500,
easing: tween.easeInOut
});
}
}
});
}
return;
}
// Only run game logic during gameplay
if (gameState === 'playing') {
// Add idle breathing animation to Summer
if (summer && !summer.isAnimating && LK.ticks % 180 === 0) {
tween(summer, {
scaleY: 1.02
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(summer, {
scaleY: 1.0
}, {
duration: 1000,
easing: tween.easeInOut
});
}
});
}
// Update timers
hungerTimer++;
happinessTimer++;
foodSpawnTimer++;
toySpawnTimer++;
// Hunger decreases every 5 seconds (300 ticks)
if (hungerTimer >= 300) {
hunger = Math.max(0, hunger - 1);
updateHungerBar();
hungerTimer = 0;
}
// Happiness decreases every 10 seconds (600 ticks) or faster when hungry
var happinessDecayRate = hunger < 30 ? 300 : 600;
if (happinessTimer >= happinessDecayRate) {
happiness = Math.max(0, happiness - 1);
updateHappinessBar();
happinessTimer = 0;
}
// Spawn food every 30 seconds (1800 ticks)
if (foodSpawnTimer >= 1800) {
spawnFood();
foodSpawnTimer = 0;
}
// Spawn toys every 45 seconds (2700 ticks)
if (toySpawnTimer >= 2700) {
spawnToy();
toySpawnTimer = 0;
}
// Update floating hearts
for (var i = hearts.length - 1; i >= 0; i--) {
var heart = hearts[i];
if (heart.alpha === 1) {
heart.floatUp();
}
}
// Check game over condition
if (happiness <= 0 && hunger <= 0) {
LK.showGameOver();
}
}
};
Pink heart no outline or shine. In-Game asset. 2d. High contrast. No shadows
Dog food. In-Game asset. 2d. High contrast. No shadows
Dog groom brush. In-Game asset. 2d. High contrast. No shadows
Pink tennis ball. In-Game asset. 2d. High contrast. No shadows
Car. In-Game asset. 2d. High contrast. No shadows
Full body person. In-Game asset. 2d. High contrast. No shadows