Class LevelExit
Parent: MovingSprite
A level exit is usually a location where Alex can regularily win the level, without any scripting intervention. Level exits however can also be used to warp Alex to other points in the same level or even into a sublevel of the current one.
Return level stack
Level exits can make use of a return level stack that allows to return to a specific level when a sublevel’s finish is reached. To activate this feature, you first have to specify a sublevel a level exit will warp Alex into as usual (see #level=). Utilizing the methods #return_level= and #return_entry= you can now dynamically specify where Alex should return when the sublevel’s default finish is reached (without setting one of these, the sublevel’s finish will be taken for the overall finish and end all current levels, advancing Alex to the next waypoint on the overworld).
This feature can be useful for bonus levels or labyrinths, probably for other complex level setups. Note it works fine recursively, i.e. you can employ the same technique in the destination sublevel again.
Events
- Exit
-
Called when this level exit is activated. If this is a warping level exit, the event handler is executed after Alex’s movements are completed (but before the camera move and before the target level entry is read from this object).
Class Methods
new
new() → a_level_exit
Creates a new level exit with the default values.
Instance Methods
activate
activate()
Activates this level exit, warping Alex to the target or ending the level.
camera_motion
camera_motion() → a_symbol
Return the level exit’s camera motion. See #camera_motion= for a list of possible return values.
camera_motion=
camera_motion=( motion ) → motion
Specify what happens to the camera when the level exit is activated.
Parameters
- motion
-
One of the following symbols:
- none
-
Directly set the camera to the new position. This is the default.
- fly
-
Slowly move the camera over to the new position.
- blink
-
Fade out at the current position and fade back in at the new position.
- path_forward
-
Make the camera follow a path. You need to use #path= to specify the target path for this.
- path_backward
-
Make the camera follow a path backwards. You need to use #path= to specify the target path for this.
entry
entry() → a_string
Returns the target level entry’s identifier for this level exit.
entry=
entry=( name ) → name
The target level entry for this level exit. If called without a prior call to #level=, allows you to warp inside the current level.
Parameters
- name
The name of the target level entry.
entry=
entry=( str ) → str
Specifies the name of the level entry that is associated with the level pushed onto the return stack (see #return_level). Set this to an empty string for requesting the default starting position of the return level. If no return level has been specified, the entry will be assumed to belong to the current level.
exit_name
exit_name() → a_string
Returns the name of this level exit. The name is used to determine which path to go on the overworld map.
exit_name=
exit_name=( str ) → str
Set the name of this level exit. The name is used to determine which path to go on the overworld map.
level
level() → a_string
Returns the destination level for this level exit as a string without path and without .tsclvl extension.
level=
level=( name ) → name
Set the destination level for this exit. If you want to warp inside the same level, use #entry= to denote a target level entry instead.
Parameters
- name
-
The name of the new level (without path and without .tsclvl extension).
path
path() → a_string
Returns the name of the camera motion path.
path=
path=( ident ) → ident
Specify the identifier for the camera movement path if you set #camera_motion= to one of the path options.
Parameters
- ident
The name of path you want to move the camera along.
return_entry
Returns the name of the level entry that is associated with the level pushed onto the return stack (see #return_level). If this returns an empty string, the default level starting position will be used. If you specify no return level, the entry will be assumed to be from the current level.
return_level
return_level() → a_string
Returns the name of the level that is placed on the stack when Alex enters this level exit. If the returned string is empty, the current level will be pushed onto the stack.
Note that this setting only takes effect if a destination sublevel has been specified (see #level=).
return_level=
return_level=( str ) → str
Specifies the name of the level that is placed on the stack when Alex enters this level exit. An empty string means to push the current level onto the stack.
Note you have to set a destination sublevel via #level= in order for this setting to have any effect.
type
type() → a_symbol
The level exit’s type. See #type= for a list of possible return values.
type=
type=( val ) → val
Specifies the level exit’s new type.
Parameters
- val
-
A symbol denoting the new type. :beam directly beams the player to the target without any animation, whereas :warp makes the player slowly move into the destined direction of this level exit (typically used for pipes).