Code edit (4 edits merged)
Please save this source code
User prompt
Create more 3 Vector2 variables to set the position of the pet when it evolves, one for each level
Code edit (1 edits merged)
Please save this source code
User prompt
Create a vector2 variable to set the position of the pet
User prompt
make the XP_PER_LEVEL double its value each time it evolves
User prompt
create a new background image and add to the game level
User prompt
Add a button to the main menu to reset the game data ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
create a background image for the main menu only
Code edit (1 edits merged)
Please save this source code
User prompt
remove the pet image from the main menu, add a logo image to the main menu and a play button image to the main menu
User prompt
create an array of images, that will change the image of the pet to react to the tasks, create a new image to when the player feeds the pet, to when to player cleans the pet, to when the player click play item etc ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Create an main menu level
Code edit (1 edits merged)
Please save this source code
User prompt
Pocket Creature Evolution
Initial prompt
Title: Pocket Creature A simple virtual pet game where players complete tasks to take care of their creature. As tasks are completed, the pet gains XP. Once the XP bar is full, the pet evolves into a new form with a different sprite. Core Mechanics Task System: Players are given basic tasks (Feed, Clean, Play). Completing a task grants XP. XP & Evolution: The pet’s XP bar gradually fills as tasks are completed. Upon reaching max XP, the pet evolves into a new sprite. Simple Controls: Tap on tasks to complete them. The pet reacts with simple animations. Minimal UI: A straightforward main menu with a single "Play Game" button leading to the main gameplay screen. Win Condition The game continues indefinitely as the pet keeps evolving with accumulated care and interaction. Players can aim to unlock all evolution stages.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { petLevel: 1, petXp: 0, lastFed: 0, lastCleaned: 0, lastPlayed: 0 }); /**** * Classes ****/ var ActionButton = Container.expand(function (actionType, position) { var self = Container.call(this); var buttonShape; if (actionType === 'feed') { buttonShape = self.attachAsset('foodItem', { anchorX: 0.5, anchorY: 0.5 }); } else if (actionType === 'clean') { buttonShape = self.attachAsset('cleaningItem', { anchorX: 0.5, anchorY: 0.5 }); } else if (actionType === 'play') { buttonShape = self.attachAsset('playItem', { anchorX: 0.5, anchorY: 0.5 }); } self.buttonType = actionType; self.interactive = true; self.down = function (x, y, obj) { tween(buttonShape, { scaleX: 0.8, scaleY: 0.8 }, { duration: 100 }); }; self.up = function (x, y, obj) { tween(buttonShape, { scaleX: 1, scaleY: 1 }, { duration: 100, onFinish: function onFinish() { if (self.buttonType === 'feed') { performFeedAction(); } else if (self.buttonType === 'clean') { performCleanAction(); } else if (self.buttonType === 'play') { performPlayAction(); } } }); }; return self; }); var MainMenu = Container.expand(function () { var self = Container.call(this); // Background image var background = self.attachAsset('menu_background', { anchorX: 0.5, anchorY: 0.5 }); background.x = 2048 / 2; background.y = 2732 / 2; // Game logo var gameLogo = self.attachAsset('game_logo', { anchorX: 0.5, anchorY: 0.5 }); gameLogo.x = 2048 / 2; gameLogo.y = 800; // Play button image var playButton = self.attachAsset('play_button', { anchorX: 0.5, anchorY: 0.5 }); playButton.x = 2048 / 2; playButton.y = 2732 / 2 + 200; playButton.interactive = true; // Reset button var resetButton = new Text2("Reset Game", { size: 60, fill: 0xFFFFFF }); resetButton.anchor.set(0.5, 0.5); resetButton.x = 2048 / 2; resetButton.y = 2732 / 2 + 400; resetButton.interactive = true; self.addChild(resetButton); // Button animations and interaction playButton.down = function (x, y, obj) { tween(playButton, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100 }); }; playButton.up = function (x, y, obj) { tween(playButton, { scaleX: 1, scaleY: 1 }, { duration: 100, onFinish: function onFinish() { if (self.onStartGame) { self.onStartGame(); } } }); }; // Reset button interactions resetButton.down = function (x, y, obj) { tween(resetButton, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100 }); }; resetButton.up = function (x, y, obj) { tween(resetButton, { scaleX: 1, scaleY: 1 }, { duration: 100, onFinish: function onFinish() { if (self.onResetGame) { self.onResetGame(); } } }); }; // Add some animation to the logo function animateLogo() { tween(gameLogo, { y: gameLogo.y - 15 }, { duration: 1500, easing: tween.easeInOut, onFinish: function onFinish() { tween(gameLogo, { y: gameLogo.y + 15 }, { duration: 1500, easing: tween.easeInOut, onFinish: animateLogo }); } }); } // Start the animation animateLogo(); return self; }); var Pet = Container.expand(function () { var self = Container.call(this); var currentLevel = storage.petLevel || 1; var petAssetId = 'pet_baby'; // Determine which asset to use based on level if (currentLevel === 1) { petAssetId = 'pet_baby'; } else if (currentLevel === 2) { petAssetId = 'pet_child'; } else if (currentLevel === 3) { petAssetId = 'pet_teen'; } else if (currentLevel >= 4) { petAssetId = 'pet_adult'; } var petGraphics = self.attachAsset(petAssetId, { anchorX: 0.5, anchorY: 0.5 }); self.happy = function () { // Bounce animation tween(self, { y: self.y - 50 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { y: self.y + 50 }, { duration: 300, easing: tween.bounceOut, onFinish: function onFinish() { petPosition.x = self.x; petPosition.y = self.y; } }); } }); }; self.evolve = function () { // Evolution animation LK.getSound('evolve').play(); // Flash and grow LK.effects.flashObject(self, 0xFFFFFF, 1000); tween(petGraphics, { scaleX: 1.5, scaleY: 1.5 }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { // Update to new visual based on new level currentLevel = storage.petLevel; var newPetAssetId; if (currentLevel === 2) { newPetAssetId = 'pet_child'; } else if (currentLevel === 3) { newPetAssetId = 'pet_teen'; } else if (currentLevel >= 4) { newPetAssetId = 'pet_adult'; } // Remove old graphic and add new one self.removeChild(petGraphics); petGraphics = self.attachAsset(newPetAssetId, { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); // Reset scale with animation tween(petGraphics, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.easeOut }); } }); }; return self; }); var ProgressBar = Container.expand(function () { var self = Container.call(this); var barBackground = self.attachAsset('progressBar_bg', { anchorX: 0, anchorY: 0.5 }); var barFill = self.attachAsset('progressBar_fill', { anchorX: 0, anchorY: 0.5 }); // Set initial width to zero barFill.width = 0; self.update = function (current, max) { var fillPercentage = current / max; var targetWidth = fillPercentage * barBackground.width; tween(barFill, { width: targetWidth }, { duration: 300, easing: tween.easeOut }); }; return self; }); var StatusText = Text2.expand(function (initialText) { var self = Text2.call(this, initialText, { size: 60, fill: 0xFFFFFF }); self.anchor.set(0.5, 0.5); self.showMessage = function (message) { self.setText(message); self.alpha = 1; tween(self, { alpha: 0 }, { duration: 3000, easing: tween.linear }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x7ED6DF }); /**** * Game Code ****/ // Game constants var BASE_XP_PER_LEVEL = 100; var XP_PER_LEVEL = BASE_XP_PER_LEVEL * Math.pow(2, petLevel - 1); // Doubles with each level var XP_GAIN_FEED = 20; var XP_GAIN_CLEAN = 15; var XP_GAIN_PLAY = 25; var COOLDOWN_TIME = 10000; // 10 seconds cooldown between actions // Game state var petXp = storage.petXp || 0; var petLevel = storage.petLevel || 1; var lastFed = storage.lastFed || 0; var lastCleaned = storage.lastCleaned || 0; var lastPlayed = storage.lastPlayed || 0; // Vector2 positions for pet at different evolution levels var petBabyPosition = { x: 2048 / 2, y: 2732 / 2 + 150 }; var petChildPosition = { x: 2048 / 2, y: 2732 / 2 + 150 }; var petTeenPosition = { x: 2048 / 2, y: 2732 / 2 + 100 }; var petAdultPosition = { x: 2048 / 2, y: 2732 / 2 + 50 }; // Track current game state var currentScreen = "menu"; var mainMenu, pet, progressBar, statusText, levelText; var feedButton, cleanButton, playButton; // Current pet position based on level var petPosition = petBabyPosition; // Initialize menu function initMainMenu() { // Clear previous game elements if they exist clearGameElements(); // Create and setup main menu mainMenu = new MainMenu(); game.addChild(mainMenu); // Set up start game callback mainMenu.onStartGame = function () { currentScreen = "game"; initGameScreen(); }; // Set up reset game callback mainMenu.onResetGame = function () { // Reset all storage values storage.petLevel = 1; storage.petXp = 0; storage.lastFed = 0; storage.lastCleaned = 0; storage.lastPlayed = 0; // Show confirmation text var confirmText = new Text2("Game data reset!", { size: 60, fill: 0xFFFFFF }); confirmText.anchor.set(0.5, 0.5); confirmText.x = 2048 / 2; confirmText.y = 2732 / 2 + 500; mainMenu.addChild(confirmText); // Fade out confirmation text tween(confirmText, { alpha: 0 }, { duration: 2000, onFinish: function onFinish() { mainMenu.removeChild(confirmText); } }); }; // Play background music LK.playMusic('bgmusic'); } // Initialize game screen function initGameScreen() { // Clear previous elements clearGameElements(); // Add game background var gameBackground = LK.getAsset('game_background', { anchorX: 0.5, anchorY: 0.5 }); gameBackground.x = 2048 / 2; gameBackground.y = 2732 / 2; game.addChild(gameBackground); // Create game elements pet = new Pet(); pet.x = petPosition.x; pet.y = petPosition.y; game.addChild(pet); // Progress bar progressBar = new ProgressBar(); progressBar.x = (2048 - progressBar.children[0].width) / 2; progressBar.y = 2732 - 200; game.addChild(progressBar); // Status text statusText = new StatusText(""); statusText.x = 2048 / 2; statusText.y = progressBar.y - 100; statusText.alpha = 0; game.addChild(statusText); // Level text levelText = new Text2("Level " + petLevel, { size: 80, fill: 0xFFFFFF }); levelText.anchor.set(0.5, 0.5); levelText.x = 2048 / 2; levelText.y = 200; game.addChild(levelText); // Create action buttons feedButton = new ActionButton('feed'); feedButton.x = 2048 / 4; feedButton.y = 2732 - 400; game.addChild(feedButton); cleanButton = new ActionButton('clean'); cleanButton.x = 2048 / 2; cleanButton.y = 2732 - 400; game.addChild(cleanButton); playButton = new ActionButton('play'); playButton.x = 2048 * 3 / 4; playButton.y = 2732 - 400; game.addChild(playButton); // Recalculate XP_PER_LEVEL based on current level XP_PER_LEVEL = BASE_XP_PER_LEVEL * Math.pow(2, petLevel - 1); // Update the progress bar on start progressBar.update(petXp, XP_PER_LEVEL); } // Clear all game elements function clearGameElements() { while (game.children.length > 0) { game.removeChild(game.children[0]); } } // Start with main menu initMainMenu(); // Play background music LK.playMusic('bgmusic'); function performFeedAction() { var currentTime = Date.now(); if (currentTime - lastFed < COOLDOWN_TIME) { statusText.showMessage("Pet is still full! Wait a moment."); return; } LK.getSound('feed').play(); pet.happy(); lastFed = currentTime; storage.lastFed = lastFed; addXp(XP_GAIN_FEED); statusText.showMessage("Pet fed! +20 XP"); } function performCleanAction() { var currentTime = Date.now(); if (currentTime - lastCleaned < COOLDOWN_TIME) { statusText.showMessage("Pet is already clean! Wait a moment."); return; } LK.getSound('clean').play(); pet.happy(); lastCleaned = currentTime; storage.lastCleaned = lastCleaned; addXp(XP_GAIN_CLEAN); statusText.showMessage("Pet cleaned! +15 XP"); } function performPlayAction() { var currentTime = Date.now(); if (currentTime - lastPlayed < COOLDOWN_TIME) { statusText.showMessage("Pet is tired! Wait a moment."); return; } LK.getSound('play').play(); pet.happy(); lastPlayed = currentTime; storage.lastPlayed = lastPlayed; addXp(XP_GAIN_PLAY); statusText.showMessage("Played with pet! +25 XP"); } function addXp(amount) { petXp += amount; storage.petXp = petXp; // Check for level up if (petXp >= XP_PER_LEVEL) { petLevel += 1; petXp = 0; storage.petLevel = petLevel; storage.petXp = petXp; // Recalculate XP_PER_LEVEL for next level - doubles with each level XP_PER_LEVEL = BASE_XP_PER_LEVEL * Math.pow(2, petLevel - 1); // Update pet position based on new level if (petLevel === 2) { petPosition = petChildPosition; } else if (petLevel === 3) { petPosition = petTeenPosition; } else if (petLevel >= 4) { petPosition = petAdultPosition; } // Update pet position pet.x = petPosition.x; pet.y = petPosition.y; levelText.setText("Level " + petLevel); pet.evolve(); if (petLevel >= 4) { statusText.showMessage("Maximum level reached!"); } else { statusText.showMessage("Pet evolved to level " + petLevel + "! Next level: " + XP_PER_LEVEL + " XP"); } } // Update progress bar progressBar.update(petXp, XP_PER_LEVEL); } // Game update function game.update = function () { // Screen-specific updates if (currentScreen === "game") { // Any per-frame updates for gameplay can go here } else if (currentScreen === "menu") { // Any per-frame updates for menu can go here } };
===================================================================
--- original.js
+++ change.js
@@ -311,9 +311,9 @@
var lastPlayed = storage.lastPlayed || 0;
// Vector2 positions for pet at different evolution levels
var petBabyPosition = {
x: 2048 / 2,
- y: 2732 / 2 + 200
+ y: 2732 / 2 + 150
};
var petChildPosition = {
x: 2048 / 2,
y: 2732 / 2 + 150
create a cute creature baby. In-Game asset. 2d. High contrast. No shadows
create a cute logo with Pocket Creature written. In-Game asset. 2d. High contrast. No shadows
create a cute button with play written inside. In-Game asset. 2d. High contrast. No shadows
create a cute room, lo fi room. In-Game asset. 2d. High contrast. No shadows
create a cute icon for cleaning item. In-Game asset. 2d. High contrast. No shadows
reimagine as a food item
Generate a smaller younger version of this character
Generate a smaller younger and cute version of this
Zoom out so it doesnt cut any elements off screen
Reimagine as younger cute version of this character
Reimagine as a younger cute version of this character
Reimagine as a cute younger version of this character
zoom out so it doesnt cut any elements off screen, make the outline thicker
Make a drawing of a cute poop. In-Game asset. 2d. High contrast. No shadows
Create an image for a memory game's card's back. In-Game asset. 2d. High contrast. No shadows
Create an image for a memory game's card's front with an icon of a play ball. In-Game asset. 2d. High contrast. No shadows
Create an image for a memory game's card's front with an icon of a chicken leg food. In-Game asset. 2d. High contrast. No shadows
Create an image for a memory game's card's front with an icon of a cute poop. In-Game asset. 2d. High contrast. No shadows
Create an image for a memory game's card's front with an icon of a cute pocket creature. In-Game asset. 2d. High contrast. No shadows
create a cute egg with some pattern and a peach and bege colors. In-Game asset. 2d. High contrast. No shadows
create a cute egg with some pattern and a light orange and light red colors. In-Game asset. 2d. High contrast. No shadows
simplify the eyes
Create a cute speech bubble with a heart. In-Game asset. 2d. High contrast. No shadows