This wiki has been moved to https://github.com/SuperTux/wiki into the mediawiki branch.

ScriptingLevel

From SuperTux
Revision as of 05:44, 25 June 2007 by RavuAlHemio (Talk | contribs)

Jump to: navigation, search


Summary

The Level class provides basic controlling functions for the current level.

Instances

An instance named Level is available from scripts and the console. (Note: class and eponymous instance might create potential conflicts – the name of one might be changed eventually)

Methods

finish(bool win) Ends the current level. If you set win to true, the level is marked as completed if launched from a worldmap.
Tip: Very useful if you have created a frustrating level and want to, at some point, save the player from agony.
spawn(string sectorname, string spawnpointname) Respawns Tux in the sector sectorname at the spawnpointname spawnpoint.
Exceptions: If sectorname or spawnpointname are empty or the specified sector does not exist, the function will bail out first chance it gets. If the specified spawnpoint doesn't exist, Tux will be spawned at the spawnpoint named main. If this spawnpoint doesn't exist either, Tux will simply end up at the origin (top-left 0, 0).
flip_vertically() Flips the level vertically (i.e. top is now bottom and vice versa). Call again to revert the effect.
Tip: Make sure the player can land on something after the level is flipped!
toggle_pause() Toggle pause

Constants

None