When I tried to write some of my first Lua programs for the Playdate, I struggled with getting button presses (do I call playdate.buttonJustPressed() or use a callback playdate.AButtonDown()?), changing fonts, playing sounds, sprites, and tilemaps. The SDK documentation is thorough and tells what functions are available and what they do, but to actually use the code, I had to search for examples one by one.
I decided to write a book that gives examples needed to accomplish some of the items mentioned above, and the book includes a link to the source code and compiled code that can be downloaded to the Playdate. You can find the book, called “Programming the Panic Pllaydate” on Amazon, and if you subscribe to Kindle Unlimited, it can be read for free. Or, the free sample includes the 10 beginner examples and the first sketch drawing program.
Included in the book are 10 beginner examples to use:
- 2 print function examples
- 5 if statement examples
- 2 for loop examples
- while loop example
Then, there are 15 programs that include 9 useful ones like:
- drawing program
- dice roller
- analog clock
- shape drawer
- fortune ball
- animation example
- music player
- maze generator
- Hitomezashi pattern generator
And 6 games:
- tic-tac-toe
- 4 in a row
- Ball Bounce - paddle and ball style game
- Breaker - paddle and ball with bricks to hit
- Pizza Maze - a pellet chomping game
- Treasure Hunt - a side scrolling game
This first edition can help someone new to the Playdate get started. Rather than compactly encapsulating the code in object oriented programming, I sought to make the code readable to someone new to Lua.
A future edition might include more object oriented programming, and have more advanced concepts (imagine making a diagonally scrolling game like Zaxxon, a strategy game like Catan or a 3-D puzzle game like Monument Valley).
The book may have revisions in the future, based on reader input, but I tried to get out my first edition, so others could use it, with the idea of revising it, as needed.
You can see some of my programs at: https://arhtur.itch.io