Source code for my Playdate game "Pocket Pets!", a Tamagotchi inspired virtual pet game. Tend to your garden, card for your pet's hunger/happiness, play mini games like a fishing mini game and a Mega Man Battle Network inspired game, and more! You can find the game on Itch IO.
![](https://private-user-images.githubusercontent.com/2004687/399845168-831847a3-042b-4586-9931-7ca321fef9d9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTEwNzcsIm5iZiI6MTczOTM1MDc3NywicGF0aCI6Ii8yMDA0Njg3LzM5OTg0NTE2OC04MzE4NDdhMy0wNDJiLTQ1ODYtOTkzMS03Y2EzMjFmZWY5ZDkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTJUMDg1OTM3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTc5NmVlZjIwNGE2N2E2ZTMzZDk4YjhhMjE0ZDE3OGNjNWRlNDliNGFhZDViNTdlZDhkOWNhZGIxYjE0ZTA1YyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.FwjxaQSf-4ETmUhcVepolvevBTzsUb112opwe4EZTuA)
![](https://private-user-images.githubusercontent.com/2004687/399845172-d7085ddf-896b-4b6e-88d3-39e1cfab00dc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTEwNzcsIm5iZiI6MTczOTM1MDc3NywicG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DU4ZjE3M2Q1Y2Y1NmI5YzY2ZjIyZDZmMDU0ZGY4M2Y5NDlmMzgxZWFiYWViN2ViMGMxZGJmNCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.m63MWRlKDX7i1QpIN6PKfdKVIrsen3VhPNzT0bz6lHc)
![](https://private-user-images.githubusercontent.com/2004687/399845180-dbb05496-3294-4dc3-8c80-83a2bf37fca0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTEwNzcsIm5iZiI6MTczOTM1MDc3NywicGF0aCI6Ii8yMDA0Njg3LzM5OTg0NTE4MC1kYmIwNTQ5Ni0zMjk0LTRkYzMtOGM4MC04M2EyYmYzN2ZjYTAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTJUMDg1OTM3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NTllNGI1MTU3MTAzOTIzM2VkMjdlMTBjODUyYzMyNDQ2MTJjYTM2ZGZkOTE0MGQ3MzRhZTU4NzQyOGE5ZTU4MyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.9o9_mUhD56bng7wO7L_SJqhLF54147OlMvf5fAiQ5XE)
scripts/
battle/
enemies/
baseEnemy.lua
- The base enemy class that allows me to easily create different enemies by extending it
battleScene.lua
- The scene for the grid battler mini-gameplayerAttackSprite.lua
- A small helper sprite that displays the slashing attack animationwarningIcon.lua
- A small helper sprite that displays the warning icon
fishing/
fishingPet.lua
- The code for your pet walking around in the fishing mini-gamefishingScene.lua
- The scene for the fishing mini-game
garden/
gardenDataDisplay.lua
- UI for the garden info at the top of the scenegardenGrid.lua
- Draws the actual garden grid, seeds, and plantsgardenScene.lua
- The scene for the gardenseedList.lua
- Handles the seed list on the side
home/
buttons/
button.lua
- The base button class to handle the buttons
food/
foodList.lua
- Handles the list drawing for the food - it's basically the same asseedList.lua
andgameList.lua
games/
gameList.lua
- Handles the list for the available mini-games - it's basically the same asseedList.lua
andfoodList.lua
pets/
pet.lua
- The base pet class that handles drawing the pet on the home screen and having them wander around - all the other pet files aren't actually used at all, so they should've been deleted
sky/
cloudBanner.lua
- Old code that handled moving clouds - not used anymoreclouds.lua
- Also not used and should've been deletedsky.lua
- Just draws the night skysun.lua
- Just handles drawing the sun or moon depending on the time of day
homeButtons.lua
- Handles the buttons on the home scenehomeScene.lua
- The scene for the main home screenstatsUI.lua
- Handles the pet stats on the top left
libraries/
AnimatedSprite.lua
- A library from Whitebrim that handles the animations for the pet in the home screenSequence.lua
- A library from Nic Magnier that let's you string together animations - I just used it for the pet hatching sceneSignal.lua
- A library from Dustin Mierau that allows you to send signals throughout your game that I used for miscellaneous data transferUtilities.lua
- A library of utility functions that I'm building up - it only has one function in it right now...
manual/
manualScene.lua
- The scene that handles drawing the QR code that links to the manual
petHatch/
petHatchScene.lua
- The scene that handles hatching a new pet
petList/
petListScene.lua
- The scene where you can see what pets you have and can switch them out
shop/
shopScene.lua
- The vending machine shop scene
wish/
wishScene.lua
- The daily wish scene
dataStore.lua
- Contains all the data that the game stores and handles saving and loading that dataglobals.lua
- A couple global functions (checking for daytime and also getting the corresponding pet image tables)sceneManager.lua
- Manages switching between scenes
All code is licensed under the terms of the MIT license, with the exception of Signal.lua
by Dustin Mierau.