LunarBasic Step-by-Step Tutorials
This course teaches LunarBasic by building small, working programs. Follow the lessons in order if you are new, or jump directly to a feature you want to learn.
How to Use This Course
- Create a new
.lbfile for each lesson. - Type the examples instead of pasting them when possible; this helps the syntax become familiar.
- Run after every numbered step. Fix the first error before moving on.
- Complete the checkpoint and challenge at the end of each lesson.
- Command-click on macOS or Ctrl-click on a built-in function on Windows to open its reference page.
Course
- Language Foundations — variables, types, expressions, strings, comments, and line continuation.
- Decisions, Data, and Routines — conditions, loops, arrays, functions, Subs, enums, and objects.
- Your First Interactive Program — create a window, build a game loop, move a player, and draw a HUD.
- Drawing, Camera, and Buffers — primitives, circles, clipping, transforms, drawing state, and off-screen rendering.
- Input, Assets, and Audio — keyboard, mouse, controllers, text input, images, sprites, fonts, and sound.
- Files, Paths, and Save Data — portable paths, text files, typed binary data, and safe resource cleanup.
- Particle Effects (Pro) — build sparks, tune motion, add bounds, and use attraction efficiently.
- Build a Physics Game (Pro) — bodies, fixed-step simulation, collision queries, filtering, rotation, and rendering.
Keep the References Nearby
- Language Reference explains the grammar and type rules.
- System Functions lists every built-in function by category.
- Debugging and Problem Solving helps when an example does not behave as expected.