itch.io is community of indie game creators and players

Devlogs

Custom made Entity Component System for Playdate

Elf Factory
A downloadable game

A scene is also made up of objects, which usually have sprites, but also have ids (which match their keys), and their own update functions that are run after the scene's update function.

The Updater (which is really the only thing playdate.update() runs... I am trying to abstract playdate away as much as possible) handles making all these calls:

There are also DrawDelayed (images and text) which is used by object or scene updates if they want to throw some stuff up on the screen such as notifications to the user or ammo counts or other HUD things as that stuff is best done after all the sprites are done being painted.

CurrentScene is the global pointer to whatever scene is currently active. There is a function called ChangeScene(newScene) which will shut down and clean up the CurrentScene, point CurrentScene to newScene and then run it's setup.

For files, I have ctrl.lua, which has all the generic functions to control the game, main.lua where things are defined (such as Scenes and other global variables), and then a file for each of the scenes, in this case just gameScreen.lua, which contains all the functions that apply to objects in that scene.

Download Elf Factory
Leave a comment