|
supertux
|
Public Types | |
| enum | FallMode { ON_GROUND, JUMPING, TRAMPOLINE_JUMP, FALLING } |
Public Member Functions | |
| Player (PlayerStatus &player_status, const std::string &name) | |
| virtual void | update (float dt_sec) override |
| This function is called once per frame and allows the object to update it's state. More... | |
| virtual void | draw (DrawingContext &context) override |
| The GameObject should draw itself onto the provided DrawingContext if this function is called. More... | |
| virtual void | collision_solid (const CollisionHit &hit) override |
| this function is called when the object collided with something solid | |
| virtual HitResponse | collision (GameObject &other, const CollisionHit &hit) override |
| this function is called when the object collided with any other object | |
| virtual void | collision_tile (uint32_t tile_attributes) override |
| called when tiles with special attributes have been touched | |
| virtual bool | is_saveable () const override |
| Indicates if the object will be saved. More... | |
| virtual bool | is_singleton () const override |
| If true only a single object of this type is allowed in a given GameObjectManager. | |
| void | set_controller (const Controller *controller) |
| void | set_winning () |
| Level solved. More... | |
| bool | is_winning () const |
| void | set_speedlimit (float newlimit) |
| float | get_speedlimit () const |
| const Controller & | get_controller () const |
| void | use_scripting_controller (bool use_or_release) |
| void | do_scripting_controller (const std::string &control, bool pressed) |
| void | make_invincible () |
| bool | is_invincible () const |
| bool | is_dying () const |
| Direction | peeking_direction_x () const |
| Direction | peeking_direction_y () const |
| void | kill (bool completely) |
| void | move (const Vector &vector) |
| bool | add_bonus (const std::string &bonus) |
| bool | set_bonus (const std::string &bonus) |
| void | add_coins (int count) |
| int | get_coins () const |
| bool | add_bonus (BonusType type, bool animate=false) |
| picks up a bonus, taking care not to pick up lesser bonus items than we already have More... | |
| bool | set_bonus (BonusType type, bool animate=false) |
| like add_bonus, but can also downgrade the bonus items carried | |
| PlayerStatus & | get_status () const |
| void | kick () |
| set kick animation | |
| void | do_cheer () |
| play cheer animation. More... | |
| void | do_duck () |
| duck down if possible. More... | |
| void | do_standup () |
| stand back up if possible. More... | |
| void | do_backflip () |
| do a backflip if possible. More... | |
| void | do_jump (float yspeed) |
| jump in the air if possible sensible values for yspeed are negative - unless we want to jump into the ground of course | |
| void | add_velocity (const Vector &velocity) |
| Adds velocity to the player (be careful when using this) | |
| void | add_velocity (const Vector &velocity, const Vector &end_speed) |
| Adds velocity to the player until given end speed is reached. | |
| Vector | get_velocity () const |
| Returns the current velocity of the player. | |
| void | bounce (BadGuy &badguy) |
| bool | is_dead () const |
| bool | is_big () const |
| bool | is_stone () const |
| void | set_visible (bool visible) |
| bool | get_visible () const |
| bool | on_ground () const |
| Portable * | get_grabbed_object () const |
| void | stop_grabbing () |
| bool | has_grabbed (const std::string &object_name) const |
| Checks whether the player has grabbed a certain object. More... | |
| void | set_ghost_mode (bool enable) |
| Switches ghost mode on/off. More... | |
| void | set_edit_mode (bool enable) |
| Switches edit mode on/off. More... | |
| bool | get_ghost_mode () const |
| Returns whether ghost mode is currently enabled. | |
| bool | adjust_height (float new_height) |
| Changes height of bounding box. More... | |
| void | trigger_sequence (const std::string &sequence_name, const SequenceData *data=nullptr) |
| Orders the current GameSession to start a sequence. More... | |
| void | trigger_sequence (Sequence seq, const SequenceData *data=nullptr) |
| Orders the current GameSession to start a sequence. More... | |
| void | start_climbing (Climbable &climbable) |
| Requests that the player start climbing the given Climbable. | |
| void | stop_climbing (Climbable &climbable) |
| Requests that the player stop climbing the given Climbable. | |
| Physic & | get_physic () |
| void | activate () |
| void | deactivate () |
| void | walk (float speed) |
| void | set_dir (bool right) |
| void | stop_backflipping () |
| void | position_grabbed_object () |
| void | try_grab () |
Public Member Functions inherited from MovingObject | |
| MovingObject (const ReaderMapping &reader) | |
| virtual bool | collides (GameObject &, const CollisionHit &) const override |
| when 2 objects collided, we will first call the pre_collision_check functions of both objects that can decide on how to react to the collision. More... | |
| virtual void | set_pos (const Vector &pos) |
| virtual void | move_to (const Vector &pos) |
| virtual bool | listener_is_valid () const override |
| Vector | get_pos () const |
| const Rectf & | get_bbox () const |
| const Vector & | get_movement () const |
| CollisionGroup | get_group () const |
| CollisionObject * | get_collision_object () |
| const CollisionObject * | get_collision_object () const |
| virtual std::string | get_class () const override |
| virtual ObjectSettings | get_settings () override |
| virtual void | editor_select () override |
| The user clicked on the object in the editor and selected it. | |
Public Member Functions inherited from GameObject | |
| GameObject (const std::string &name) | |
| GameObject (const ReaderMapping &reader) | |
| virtual void | finish_construction () |
| Called after all objects have been added to the Sector and the Sector is fully constructed. More... | |
| UID | get_uid () const |
| void | save (Writer &writer) |
| This function saves the object. More... | |
| virtual std::string | get_display_name () const |
| virtual bool | has_variable_size () const |
| Does this object have variable size (secret area trigger, wind, etc.) | |
| virtual bool | has_settings () const |
| Indicates if get_settings() is implemented. More... | |
| virtual void | after_editor_set () |
| bool | is_valid () const |
| returns true if the object is not scheduled to be removed yet | |
| void | remove_me () |
| schedules this object to be removed at the end of the frame | |
| void | add_remove_listener (ObjectRemoveListener *listener) |
| registers a remove listener which will be called if the object gets removed/destroyed | |
| void | del_remove_listener (ObjectRemoveListener *listener) |
| unregisters a remove listener, so it will no longer be called if the object gets removed/destroyed | |
| void | set_name (const std::string &name) |
| const std::string & | get_name () const |
| virtual const std::string | get_icon_path () const |
| virtual void | stop_looping_sounds () |
| stops all looping sounds | |
| virtual void | play_looping_sounds () |
| continues all looping sounds | |
| template<typename T > | |
| T * | get_component () |
| void | add_component (std::unique_ptr< GameObjectComponent > component) |
| void | remove_component (GameObjectComponent *component) |
| virtual void | editor_delete () |
| The editor requested the deletion of the object. | |
| virtual void | editor_deselect () |
| The object got deselected. | |
| virtual void | editor_update () |
| Called each frame in the editor, used to keep linked objects together (e.g. More... | |
Public Member Functions inherited from ExposedObject< Player, scripting::Player > | |
| ExposedObject (Player *parent) | |
| Constructor. More... | |
| virtual void | expose (HSQUIRRELVM vm, SQInteger table_idx) override |
| Exposes the parent GameObject to the script Interface. More... | |
| virtual void | unexpose (HSQUIRRELVM vm, SQInteger table_idx) override |
| Un-exposes the parent GameObject to the script Interface. More... | |
Public Attributes | |
| Direction | m_dir |
| float | m_last_ground_y |
| FallMode | m_fall_mode |
| bool | m_does_buttjump |
| Timer | m_invincible_timer |
| Timer | m_dying_timer |
Additional Inherited Members | |
Protected Member Functions inherited from MovingObject | |
| void | set_group (CollisionGroup group) |
Protected Attributes inherited from MovingObject | |
| CollisionObject | m_col |
Protected Attributes inherited from GameObject | |
| std::string | m_name |
| a name for the gameobject, this is mostly a hint for scripts and for debugging, don't rely on names being set or being unique | |
| bool Player::add_bonus | ( | BonusType | type, |
| bool | animate = false |
||
| ) |
picks up a bonus, taking care not to pick up lesser bonus items than we already have
| bool Player::adjust_height | ( | float | new_height | ) |
Changes height of bounding box.
Returns true if successful, false otherwise
| void Player::do_backflip | ( | ) |
do a backflip if possible.
| void Player::do_cheer | ( | ) |
play cheer animation.
This might need some space and behave in an unpredictable way. Best to use this at level end.
| void Player::do_duck | ( | ) |
duck down if possible.
this won't last long as long as input is enabled.
| void Player::do_standup | ( | ) |
stand back up if possible.
|
overridevirtual |
The GameObject should draw itself onto the provided DrawingContext if this function is called.
Implements GameObject.
| bool Player::has_grabbed | ( | const std::string & | object_name | ) | const |
Checks whether the player has grabbed a certain object.
| name | Name of the object to check |
|
inlineoverridevirtual |
Indicates if the object will be saved.
If false, the object will be skipped on saving and can't be cloned in the editor.
Reimplemented from GameObject.
| void Player::set_edit_mode | ( | bool | enable | ) |
Switches edit mode on/off.
In edit mode, Tux will enter ghost_mode instead of dying.
| void Player::set_ghost_mode | ( | bool | enable | ) |
Switches ghost mode on/off.
Lets Tux float around and through solid objects.
| void Player::set_winning | ( | ) |
Level solved.
Don't kill Tux any more.
| void Player::trigger_sequence | ( | const std::string & | sequence_name, |
| const SequenceData * | data = nullptr |
||
| ) |
Orders the current GameSession to start a sequence.
| sequence_name | Name of the sequence to start |
| data | Custom additional sequence data |
| void Player::trigger_sequence | ( | Sequence | seq, |
| const SequenceData * | data = nullptr |
||
| ) |
Orders the current GameSession to start a sequence.
| sequence | Sequence to start |
| data | Custom additional sequence data |
|
overridevirtual |
This function is called once per frame and allows the object to update it's state.
The dt_sec is the time that has passed since the last frame in seconds and should be the base for all timed calculations (don't use SDL_GetTicks directly as this will fail in pause mode). This function is not called in the Editor.
Implements GameObject.
1.8.12