supertux
player.hpp
1 // SuperTux
2 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HEADER_SUPERTUX_SCRIPTING_PLAYER_HPP
18 #define HEADER_SUPERTUX_SCRIPTING_PLAYER_HPP
19 
20 #ifndef SCRIPTING_API
21 #include <string>
22 
23 #include "scripting/game_object.hpp"
24 
25 class Player;
26 #endif
27 
28 namespace scripting {
29 
30 class Player final
31 #ifndef SCRIPTING_API
32  : public GameObject<::Player>
33 #endif
34 {
35 #ifndef SCRIPTING_API
36 public:
37  using GameObject::GameObject;
38 
39 private:
40  Player(const Player&) = delete;
41  Player& operator=(const Player&) = delete;
42 #endif
43 
44 public:
49  bool add_bonus(const std::string& bonus);
54  bool set_bonus(const std::string& bonus);
62  void add_coins(int count);
66  int get_coins() const;
70  void make_invincible();
74  void deactivate();
78  void activate();
82  void walk(float speed);
86  void set_dir(bool right);
90  void set_visible(bool visible);
95  bool get_visible() const;
96 
101  void kill(bool completely);
102 
107  void set_ghost_mode(bool enable);
108 
112  bool get_ghost_mode() const;
113 
117  void kick();
118 
123  void do_cheer();
124 
129  void do_duck();
130 
134  void do_standup();
135 
139  void do_backflip();
140 
145  void do_jump(float yspeed);
146 
150  void trigger_sequence(const std::string& sequence_name);
151 
155  void use_scripting_controller(bool use_or_release);
156 
161  bool has_grabbed(const std::string& name) const;
162 
166  void do_scripting_controller(const std::string& control, bool pressed);
167 
168  float get_velocity_x() const;
169  float get_velocity_y() const;
170 };
171 
172 } // namespace scripting
173 
174 #endif
175 
176 /* EOF */
Definition: player.hpp:30
WARNING: This file is automatically generated from: &#39;src/scripting/wrapper.interface.hpp&#39; DO NOT CHANGE.
Definition: ambient_sound.cpp:21
void do_duck()
duck down if possible.
Definition: player.cpp:136
void kill(bool completely)
Hurts Tux, if completely=true then he will be killed even if he had grow or fireflower bonus...
Definition: player.cpp:101
Definition: game_object.hpp:60
void use_scripting_controller(bool use_or_release)
Uses a scriptable controller for all user input (or restores controls)
Definition: player.cpp:171
void do_scripting_controller(const std::string &control, bool pressed)
Instructs the scriptable controller to press or release a button.
Definition: player.cpp:178
void do_cheer()
play cheer animation.
Definition: player.cpp:129
bool get_visible() const
returns true if Tux is currently visible (that is he was not set invisible by the set_visible method)...
Definition: player.cpp:94
void do_jump(float yspeed)
jump in the air if possible sensible values for yspeed are negative - unless we want to jump into the...
Definition: player.cpp:157
void do_standup()
stand back up if possible.
Definition: player.cpp:143
void set_dir(bool right)
Face Tux in the proper direction.
Definition: player.cpp:80
void walk(float speed)
Make Tux walk.
Definition: player.cpp:73
void set_visible(bool visible)
Set player visible or invisible.
Definition: player.cpp:87
void trigger_sequence(const std::string &sequence_name)
Orders the current GameSession to start a sequence.
Definition: player.cpp:164
void add_coins(int count)
Give tux more coins.
Definition: player.cpp:38
void deactivate()
Deactivate user/scripting input for Tux.
Definition: player.cpp:59
int get_coins() const
Returns the number of coins the player currently has.
Definition: player.cpp:45
void kick()
start kick animation
Definition: player.cpp:122
bool get_ghost_mode() const
Returns whether ghost mode is currently enabled.
Definition: player.cpp:115
void do_backflip()
do a backflip if possible.
Definition: player.cpp:150
bool set_bonus(const std::string &bonus)
Replaces the Tux&#39;s bonus with another bonus.
Definition: player.cpp:31
void activate()
Give control back to user/scripting.
Definition: player.cpp:66
void make_invincible()
Make tux invincible for a short amount of time.
Definition: player.cpp:52
bool add_bonus(const std::string &bonus)
Set tux bonus.
Definition: player.cpp:24
void set_ghost_mode(bool enable)
Switches ghost mode on/off.
Definition: player.cpp:108
Definition: player.hpp:39
bool has_grabbed(const std::string &name) const
Check whether player is carrying a certain object.
Definition: player.cpp:199