This wiki has been moved to https://github.com/SuperTux/wiki into the mediawiki branch.
This module contains methods controlling the player. (No, SuperTux doesn't use mind control. Player refers to the type of the player object.)
Due to SuperTux's single-player nature, there is only one instance of the Player object. You can access it via Tux from a script and sector.Tux from the console.
|add_bonus(string bonusname)||Gives Tux the specified bonus. Replace bonusname with either of "grow", "fireflower" or "iceflower".|
|add_coins(int number)|| Gives Tux number coins.|
Tip: Tux has to pay 25 coins to be revived at the last firefly he visited. If he doesn't have enough coins, the player has to play the whole level again.
|make_invincible()|| Makes the player invincible for either a predefined amount of time.|
See also: TUX_INVINCIBLE_TIME in src/object/player.hpp for the amount of seconds that the player becomes invincible.
|deactivate()|| Stops the player and blocks the movement controls.|
Tip: Don't call this in front of a horde of badguys. Carried items like trampolines won't be dropped.
|activate()||Reactivates the player's movement controls.|
|walk(float speed)||Make Tux walk|
|set_visible(bool visible)||Shows or hides Tux according to the value of visible. Note: Tux doesn't interact with objects or badguys while invisible.|
|get_visible()||Returns: bool; is Tux visible?|
|kill(bool completely)||Hurts a player, if completely=true then the player will be killed even if he had grow or fireflower bonus.|
|set_ghost_mode(bool enable)|| Switches ghost mode on/off.|
Lets Tux float around and through solid objects.
|get_ghost_mode()||Returns whether ghost mode is currently enabled|
|do_cheer()||Makes Tux cheer, if possible.|
|do_duck()||Makes Tux duck, if possible.|
|do_standup()||Makes Tux stand up, if possible.|
|do_backflip()||Makes Tux backflip, if possible.|
|do_jump()||Makes Tux jump, if possible.|
|trigger_sequence(string sequence_name)||Orders the current GameSession to start a sequence. One of "stoptux", "endsequence", or "fireworks".|
|use_scripting_controller(bool use_or_release)||Uses a scriptable controller for all user input (or restores controls)|
|do_scripting_controller(string control, bool pressed)||Instructs the scriptable controller to press or release a button. control can be "left", "right", "up", "down", "jump", "action", "pause-menu", "menu-select", "console", "peek-left", or "peek-right".|
|Ambient sound · Camera · Candle · Display effect · Floating image · Globals · Level · Level time · Path · Platform · Player · Scripted object · Sector · Sound · Text · Thunderstorm · Tilemap · Will-o-wisp · Wind|