Scripting reference
A level script is AngelScript code that belongs to a level. The game compiles it when the level loads and then calls functions of a few well-known names that the script defines, called hooks. Everything a hook does goes through the API described here.
Where to start:
- AngelScript quick reference — types, operators, handles and other basics of the language, if AngelScript is new to you
- Hooks — functions a script defines and the game calls, such as onLevelLoad(), onMain() or onPlayer()
- jjPLAYER — a player, its position, health, weapons and controls
- jjOBJ — an object of the level (enemies, pickups, bullets, platforms), all of them are in jjObjects
- jjLAYER — a layer of tiles, its scrolling and appearance
- jjCANVAS — drawing over the HUD or into the level from the drawing hooks
- Global functions and properties — the state of the level and the game, sounds, palette and more
- Preprocessor directives — lines such as
#includeand#pragmathat are handled before a script is compiled
Time in a level script is measured in ticks, 70 of them per second. jjGameTicks counts them.
A script that starts with #pragma target Resurrection uses the native API of the game instead, which isn't covered by this reference.
Supported platforms
Scripting is an optional part of the game and it's currently turned off in all official builds. AngelScript has to call functions of the game directly, which it can do only on some processors, so it could be turned on in the following versions of the game:
- Windows on x86, x64 and ARM64 processors, including Xbox
- Linux on x86, x64, ARM, ARM64 and RISC-V processors, including PortMaster handhelds
- macOS on Intel and Apple Silicon processors
- Android and iOS
- Nintendo Switch and PlayStation Vita
- Web browsers (WebAssembly)
Other consoles and Amiga systems would need more work or have too little memory for it.