Source code for the Playdate game "Core Fault", made by me (SquidGod) and davemakes. A mini Vampiror Survivors-like game where you control a remoted operated mining droid, using crank operated movement to weave around and fight enemies, get upgrades, and run it back. I handled most of the code, and davemakes handled all the art, music, sfx, and most of the game balancing. You can find it on Catalog and Itch IO.
![](https://private-user-images.githubusercontent.com/2004687/399881588-d899a755-b080-4fdd-b17c-8e6daf68337c.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTEwNzIsIm5iZiI6MTczOTM1MDc3MiwicGF0aCI6Ii8yMDA0Njg3LzM5OTg4MTU4OC1kODk5YTc1NS1iMDgwLTRmZGQtYjE3Yy04ZTZkYWY2ODMzN2MuZ2lmP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTJUMDg1OTMyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmYwNGFjOTE2Mzc2NmI2NmM1ODhkYzI0OWFkNTczZjczYmRiN2JmMmMwM2FhMTBmNWRmZTJjNTgzNjY3ZDhhOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.2wnQr_DxuDiQRzhgNO6YeLj8NfeqT51WREzaARwrsxM)
![](https://private-user-images.githubusercontent.com/2004687/399881071-8d9094c4-5fa4-4ad9-baa1-c8719d4d9440.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTU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ZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NmI4NmY0ZTQzNjk0NDAyMmI2NDdkOGQ0N2Q3YWQ3MzgzYmI3ZjY4NTU5NWEyZDM1Y2QwOGZlNWI2YTAzZDZmOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.OWCL-dzqknF5k9Aqzug_k3wYJO9O_u7yqvZ8p50jjfM)
![](https://private-user-images.githubusercontent.com/2004687/399881324-363f3a4f-704d-40b3-8174-c4860253377f.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTEwNzIsIm5iZiI6MTczOTM1MDc3MiwicGF0aCI6Ii8yMDA0Njg3LzM5OTg4MTMyNC0zNjNmM2E0Zi03MDRkLTQwYjMtODE3NC1jNDg2MDI1MzM3N2YuZ2lmP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTJUMDg1OTMyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWNjOWZhYjUyYTQ4MzdjNTNkYTJjNmFlZjA0NjVkMGQ5MGEzYTFkM2E5NmNlNDA3ZjgyYTgyOGFhZDFiODNmNyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.285YK1rBSPZV_cB_HA_3aBk8wL07Wky9rjzQMsMaZno)
scripts/
audio/
musicPlayer.lua
- A music manager used to manage the songs being playedsfxPlayer.lua
- A small helper class to play sfx without reloading the sound file every timesoundFiles.lua
- A data file to load all the sounds at once in the beginning, for performance reasons
data/
enemyStats.lua
- Holds all enemy stats, so we can change it in one placeequipmentData.lua
- Holds all equipment statsplayerStats.lua
- Holds all base player statsspawnProbabilities.lua
- Holds all the enemy spawn weights for each depth levelstoredDataManager.lua
- Manages saving and loading dataunlockData.lua
- Holds all the unlocks and their statsupgradeData.lua
- Holds all upgrade stats
game/
gameUI/
selectionPanel.lua
- The UI for selecting equipment or upgrades during the runstreakBackground.lua
- The dynamically animated streaking backgroundswapPanel.lua
- The UI for swapping out your equipment
gameManager.lua
- The overall game state manager that manages the entire run from start to finishgameOverScene.lua
- The final scene in a run that shows your resultsstartScene.lua
- The beginning scene in a run that shows you your initial equipment choicesupgradeScene.lua
- The scene between levels that allows you to upgrade your droid
level/
enemies/
- Houses all the enemiescrab.lua
crabMedium.lua
enemy.lua
- The parent enemy class that all the enemies extendenemyProjectile.lua
- Class that handles the projectile object for enemiesfly.lua
flyMedium.lua
slime.lua
slimeMedium.lua
mapGeneration/
mapGenerator.lua
- Generates all the walls and layout of a levelmapPatterns.lua
- A data file that stores all the different layout types, which I separated out for organization
ore/
ore.lua
- The individual class that instances the ore in a leveloreSpawner.lua
- Manages spawning ore in empty spots, keeping track of the ore mined, and drawing the ore count
player/
equipment/
- Holds all the equipment constructorscomponents/
- A sort of pseudo-entity component system that was created to share functionality/code between equipmentdoesAOEDamage.lua
doesDamage.lua
equipment.lua
- Parent class for all equipment, and handles upgrading the equipment based on levelfiresProjectile.lua
followsPlayer.lua
hasCooldown.lua
projectile.lua
beam.lua
discharge.lua
peaShooter.lua
plasmaCannon.lua
pocketDrill.lua
radioWaves.lua
shockProd.lua
staticField.lua
subterraneanRocket.lua
upgrades/
- Holds all upgrade constructorsattackSpeed.lua
critChance.lua
critDamage.lua
damage.lua
health.lua
healthRegen.lua
moveSpeed.lua
piercing.lua
restoration.lua
healthbar.lua
- Keeps track of player health and draws the health barplayer.lua
- Handles pretty much everything related to the player (movement, drawing, collision, equipment, upgrades, etc.)
hud.lua
- Manages drawing the XP and remaining timelevelScene.lua
- Scene for managing each individual level, which parents everything else in this folder
libraries/
AnimatedSprite.lua
- By Whitebrim: animation state machineSceneManager.lua
- The scene manager that I made a tutorial on that manages switching between scenes
title/
titleScene.lua
- Title screen UIunlockScene.lua
- Unlocks screen UI
main.lua
- Globals, main update, and handles loop to update projectiles
All code is licensed under the terms of the MIT license.