-
-
Notifications
You must be signed in to change notification settings - Fork 491
ScriptingHome
Since May 2005, SuperTux sports a Squirrel scripting interface useful for level designers who want to add some interactive pep to their levels. This document poses as a reference article for those who want to explore the various objects of the SuperTux scripting model.
One of your first questions might be, “What does a rodent have to do with a penguin?” Squirrel is a language with a syntax not much unlike other C-like languages (C, C++, Java, ...). In the current implementation, it is integrated as elements in the SuperTux level and worldmap files. The Console is a full-fledged Squirrel interpreter as well.
I have no clue if the developers simply chose Squirrel just because the name so nicely integrates into the series of words “SuperTux” and “S-Expression”. Currently, the Squirrel code is integrated in string arguments of Scheme elements in SuperTux level files. (Whew.) This is an example code block inside a level:
(supertux-level
(version 2)
(name (_ "Go Blind"))
(author "Team")
(sector
(name "main")
(music "Annoying_penguin_gawking_sounds.ogg")
;; tilemaps, objects, whatever. (optional)
;...
(init-script "
Effect.fade_out(2.5);
")
;; more tilemaps, objects, and whatever. (optional)
;...
)
)
When this level loads, the screen fades out completely during two and a half seconds right after the level is loaded. (Mind you, this would be a frustrating experience for the player if you add a horde of badguys near the spawn point...)
If you are interested in an object and what cans of worms you can open with it, this section is for you.
“(NYI)” after the function name symbolises functions that haven't been implemented yet. Calling them will result in a line being printed to standard output informing anybody who reads it that the script is using a function that actually doesn't exist.
${SRG_CLASSLIST}
Home
Guidelines
Game Mechanics
Tools
Engine
- Cameras in other games
- Collision
- Configuration File
- Console
- Cutscenes
- Game_Engine
- Lighting
- Map_transformer
- Portables
- SceneGraph
- Scripting
Specifications
Milestones
- Milestone 1 Analysis
- Milestone 2 Design Document
- Milestone 2 Design Document Old
- Milestone 3 Design Document
Building (mostly outdated)
- INSTALL.md
- Building
- Building on macOS
- Building SuperTux
- Building on Windows
- Building with MXE (cross-compile)
Meetings