Bird's-eye view of a PuzzleScript file

A puzzlescript file is divided into 8 sections:


Before any of the "official" sections are declared, you can give details about your project in this section, and also set some editor options.

title 2D Whale World
author increpare

key_repeat_interval 0.12
Here are the possible options:

author increpare
Your name goes here. This will appear in the title screen of the game.
color_palette mastersystem
By default, when you use colour names, they are pulled from a variation of Arne's 16-Colour palette. However, there are other palettes to choose from:

  • 1 - mastersystem
  • 2 - gameboycolour
  • 3 - amiga
  • 4 - arnecolors
  • 5 - famicom
  • 6 - atari
  • 7 - pastel
  • 8 - ega
  • 9 - amstrad
  • 10 - proteus_mellow
  • 11 - proteus_rich
  • 12 - proteus_night
  • 13 - c64
  • 14 - whitingjp

(you can also refer to them by their numerical index)

again_interval 0.1
The amount of time it takes an 'again' event to trigger.
background_color blue
Can accept a color name or hex code (in the form #412bbc). Controls the background color of title/message screens, as well as the background color of the website. Text_color is its sibling.
This outputs the compiled instructions whenever you build your file. For instance, the line

 Edit[ > Player | Crate ] -> [ > Player | > Crate ]

is compiled into four instructions, as the output from debug shows when you hit 'RUN':

Rule Assembly : (4 rules)
  (83) DOWN [ crate | up player ] -> [ up crate | up player ]
+ (83) DOWN [ down player | crate ] -> [ down player | down crate ]
+ (83) RIGHT [ crate | left player ] -> [ left crate | left player ]
+ (83) RIGHT [ right player | crate ] -> [ right player | right crate ]
Going from left to right:
  • The number near the left is the line-number the rule came from in the original source code. You can click on the number to jump to that line in the file.
  • A plus-sign on the left of the line indicates that the rule is grouped with the previous one as part of a rule-group and the engine will loop through the group as a whole trying to apply the rules until no more rules in the group can be applied (See the rules page for more info).

The compiler does a lot of stuff to the rules you give to it to 'simplify' them in various ways. One thing it does for instance is replace all relative directions ( ^, v, <, and >), with UP, DOWN, LEFT, and RIGHT, which often involves splitting a single rule into many more rules (as above). An other thing you'll notice is that the core engine has rules only going DOWN and RIGHT - rules in other directions are flipped. For more information about directions in puzzlescript, see this page.

flickscreen WxH
Setting flickscreen divides each level into WxH grids, and zooms the camera in so that the player can only see one at a time - the camera does not follow the player around on a move-to-move basis, but if the player moves from one part of this grid to another, the camera flicks to the new position. See Legend of Zokoban for a cute example.
The homepage of the author. This doesn't appear directly in the game itself, but is included in the shared game and exported HTML build.
key_repeat_interval 0.1
When you hold down a key, how long is the delay between repeated presses getting sent to the game (in seconds)? The default value is 1.5.
Changes the action key (X) instruction from the title screen, and does not respond when the player pressed it (outside of menus and cutscenes and the like).
For many games, you don't want holding action down to retrigger it - games where you're toggling a switch, say. For these games, set norepeat_action, and the action button will only respond to individual presses.
Disables the undo key (Z) (I generally advise against disabling undo, FWIW).
Disables the restart key (R)
The number indicates how long each realtime frame should be. In the above case, twice a second the game engine will tick, but with no input. Player input is processed as regular. See this documentation for more info on making realtime games.
This is a common requirement in games - if the player doesn't move, cancel the whole move. This is equivalent, where there's only one player character, to the following:
[ Player ]->[ Player Temp ]
late [ Player Temp ] -> CANCEL
late [ Temp ] -> [ ]
For some games you will want, before the player sees the level, for the rules to be applied once. (Games that have rules that generate level graphics on the fly, for instance, may want this. Try out this game with and without the prelude option and compare results.)
Applies a scanline visual effect - only draws every other line
text_color blue
Can accept a color name or hex code (in the form #412bbc). Controls the font color of title/message screens, as well as the font color in the website. Background_color is its sibling.
title My Amazing Puzzle Game
The name of your game. Appears on the title screen.
For use in conjunction with realtime_interval - this stops you from moving crazy fast - repeated keypresses of the same movement direction will not increase your speed. This doesn't apply to the action button. If you can think of an example that requires action be throttled, just let me know and I'll try accommodate you.
As you play the game, spits out information about all rules applied as you play, and also allows visual inspection of what exactly the rules do with the visual debugger.
zoomscreen WxH
Zooms the camera in to a WxH section of the map around the player, centered on the player. Silly example.