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

ScriptingPlayer

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

Jump to: navigation, search


Summary

This module contains methods controlling the player. (No, SuperTux doesn't use mind control. Player refers to the type of the player object.)

Instances

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.

Methods

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(float time) Makes the player invincible for either a custom or 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 in case time is not specified.
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.
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.

Constants

None