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.
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.