This wiki has been moved to into the mediawiki branch.

Difference between revisions of "Level format"

From SuperTux
Jump to: navigation, search
(Moved text from File Formats)
Line 178: Line 178:
[[Category:Game Engine]]

Revision as of 00:56, 28 June 2006

The level format is a bit complex, which is why [ Flexlay] can prove itself very useful as an editor. If you are interested in how the levels look like or want to edit them manually (and find some of the parameters not self-explanatory enough), then you may read or skim through this section.

;; Generated by Flexlay Editor (or Emacs or Vi or whatever)
(supertux-level                       ;; This initiates a level.

  (version 2)                         ;; This document only describes version 2. Version 1 is deprecated
                                      ;; and I'm not going to teach it since it lacks a lot of features.

  (name (_ "Some demo level"))        ;; Name of the level. Call it a nice name. Note that this should be
                                      ;; internationalised (that's why the extra underscore and brackets).

  (author "Ondra Hosek")              ;; Put your name here unless you are me (very improbable)

  (sector                             ;; A level is divided into independent sectors that can be connected
                                      ;; by doors.

    (name "main")                     ;; Tux begins in the sector named "main".

    (music "ondraschipdisko.ogg")     ;; Name of the music file. See the data/music/ directory.

    (gravity 10.0)                    ;; Gravity of Tux. 10.0 is the default and sanest value (unless you
                                      ;; are ready to apply the level design correctly).

    (tilemap                          ;; Here come the tiles.
      (layer "background")            ;; Currently, there are three layer types: "background",
                                      ;; "interactive" and "foreground".

      (solid  #f)                     ;; Will Tux collide with tiles in this tilemap?
                                      ;; Note: only one tilemap can be solid per sector.

      (speed  1.0)                    ;; If the tilemap is solid, this has to be 1. Basically sets how
                                      ;; fast the tilemap scrolls.

      (width  5)                      ;; Number of tiles you plan to put in a row...
      (height 5)                      ;; ... and in a column. (5x5 is pretty tiny; small Tux
                                      ;; takes up 1x1 tiles, big Tux 1x2 tiles).

      (tiles                          ;; Integer lists of which tiles you want to use.
        0 0 0 0 0                     ;; The tiles and their numbers are defined in
        0 0 0 0 0                     ;; data/images/tiles.strf.
        0 0 0 0 0
        0 0 0 0 0
        0 0 0 0 0
      (layer "interactive")
      ;; See the background layer definition.
      (layer "foreground")
      ;; ...

    (camera                           ;; Definitions of the camera paths

      (mode "autoscroll")             ;; This can be set to "normal" to deactivate
                                      ;; forced scrolling. Then you can omit the
                                      ;; "path" directive.

      (path                           ;; Forced scrolling path

        (point (x 2) (y 3) (speed 2)) ;; Point to which camera will scroll.

          ;; ...

      (backscrolling #f)              ;; You can prevent the camera from scrolling
                                      ;; backwards with this setting. Applies only
                                      ;; to the normal camera mode.

      (image "ocean.jpg")             ;; Background from data/images/background
      (speed 0.5)                     ;; Scrolling speed

    (spawnpoint                       ;; A spawning point for Tux. By default, he is
      (name "main")                   ;; spawned at spawnpoint named "main".
      (x 0)
      (y 0)

    (init-script "
// A Squirrel script
// See the scripting reference for more information.

    ;; Here you can add badguys of your choice.
    ;; Details on this can be read later in this chapter.

    ;; Particle systems
    ;; It is advisable only to use one particle system at a time.

    (particles-<type>                 ;; Valid values for <type> are rain, snow and clouds

      (layer 201)                     ;; -100 are background, 0 are interactive, 200 are foreground tiles.
                                      ;; Choose a number to put the rain between two layers. In this case,
                                      ;; the rain is in front of the foreground tiles. (see also
                                      ;; src/video/drawing_context.hpp)


      (time 300)                      ;; The player must complete this level
                                      ;; within 300 seconds.
  ) ;; End of sector

  ;; You can add other sectors here.
;; End of level


This section describes the various badguys and their parameters.

The next few sections describe the extra parameters for the other badguys.

Common parameters

  (x 270)                 ;; The badguy's X coordinate.
  (y 126)                 ;; The badguy's Y coordinate. (Note that the origin is in the top-left corner!)
  (stay-on-platform #f)   ;; Optional. Should the badguy do its best not to fall from the platform it's on? (NYI)

Bouncing Snowballs, Flying Snowballs, Jumpies, Mr Bombs, Mr Iceblocks, Mr Rockets, Mr Trees, World 1 Noloks, Poison Ivies, Snowballs, Spikies, Stalactites, Yeti Stalactites and Zeeklings only require this list of parameters. Simply substitute <badguy-name> with one of the following:

  • bouncingsnowball
  • flyingsnowball
  • jumpy
  • mrbomb
  • mriceblock
  • mrrocket
  • mrtree
  • nolok_01
  • poisonivy
  • snowball
  • snowsnail
  • spidermite
  • spiky
  • stalactite
  • yeti_stalactite
  • zeekling


  (cycle 3)               ;; How often should a badguy be dispensed?
  (badguy random)         ;; Valid values are "snowball", "bouncingsnowball", "mrbomb",
                          ;; "mriceblock", "mrrocket", "poisonivy", "snowsnail", or "random".


  (radius 3)              ;; How big should the radius of the circle be that the flame
                          ;; follows?
  (speed 10)              ;; How fast should the flame be?

Lightning orb

The lighting orb ("kugelblitz") ignores the y coordinate, spawning above the visible screen.


Don't mistake this badguy for Spiky! Spiky is the snowball-like creature with spikes, whilst a spike is an object serving the same purpose like the stalactite.

  (direction 2)           ;; 0: north, 1: south, 2: west, 3: east


  (dead-script "
// A squirrel script that is executed once the Yeti dies.