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

Difference between revisions of "ScriptingLevel"

From SuperTux
Jump to: navigation, search
m (Methods: updated to current svn)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
  
= Summary =
+
== Summary ==
 
The <tt>Level</tt> class provides basic controlling functions for the current level.
 
The <tt>Level</tt> class provides basic controlling functions for the current level.
  
= Methods =
+
== Instances ==
 +
An instance named <tt>Level</tt> 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 ==
 
{| class="objectlist"
 
{| class="objectlist"
 
! class="method" style="vertical-align: top"| finish(bool win)
 
! class="method" style="vertical-align: top"| finish(bool win)
Line 19: Line 22:
 
|}
 
|}
  
= Constants =
+
== Constants ==
  
 
None
 
None
  
 
[[Category:Scripting Reference]]
 
[[Category:Scripting Reference]]

Revision as of 05:44, 25 June 2007


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