supertux
skydive.hpp
1 // SuperTux
2 // Copyright (C) 2010 Florian Forster <supertux at octo.it>
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_BADGUY_SKYDIVE_HPP
18 #define HEADER_SUPERTUX_BADGUY_SKYDIVE_HPP
19 
20 #include "badguy/badguy.hpp"
21 
22 class SkyDive final : public BadGuy
23 {
24 public:
25  SkyDive(const ReaderMapping& reader);
26 
27  virtual void kill_fall() override;
28 
29  virtual void collision_solid(const CollisionHit& hit) override;
30  virtual HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit) override;
31  virtual void collision_tile(uint32_t tile_attributes) override;
32  virtual void initialize() override;
33 
34  /* Inherited from Portable */
35  virtual void grab(MovingObject& object, const Vector& pos, Direction dir) override;
36  virtual void ungrab(MovingObject& object, Direction dir) override;
37 
38  virtual bool is_freezable() const override;
39 
40  virtual std::string get_overlay_size() const override { return "2x2"; }
41  static std::string class_name() { return "skydive"; }
42  virtual std::string get_class_name() const override { return class_name(); }
43  static std::string display_name() { return _("Skydive"); }
44  virtual std::string get_display_name() const override { return display_name(); }
45  virtual GameObjectClasses get_class_types() const override { return BadGuy::get_class_types().add(typeid(SkyDive)); }
46  virtual bool is_snipable() const override { return true; }
47 
48 protected:
49  virtual std::vector<Direction> get_allowed_directions() const override;
50 
51 private:
52  virtual HitResponse collision_player(Player& player, const CollisionHit& hit) override;
53  virtual bool collision_squished (GameObject& obj) override;
54 
55  void explode();
56  virtual bool is_portable() const override;
57 
58 private:
59  SkyDive(const SkyDive&) = delete;
60  SkyDive& operator=(const SkyDive&) = delete;
61 };
62 
63 #endif
64 
65 /* EOF */
Base class for moving sprites that can hurt the Player.
Definition: badguy.hpp:38
virtual std::string get_display_name() const override
Returns the display name of the object, translated to the user&#39;s locale.
Definition: skydive.hpp:44
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: badguy.hpp:71
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: skydive.hpp:45
virtual void initialize() override
called immediately before the first call to initialize
Definition: skydive.cpp:168
virtual HitResponse collision_badguy(BadGuy &badguy, const CollisionHit &hit) override
Called when the badguy collided with another badguy.
Definition: skydive.cpp:55
virtual void collision_solid(const CollisionHit &hit) override
Called when the badguy collided with solid ground.
Definition: skydive.cpp:36
virtual void collision_tile(uint32_t tile_attributes) override
Called when a collision with tile with special attributes occurred.
Definition: skydive.cpp:159
This class is responsible for: Updating and drawing the object.
Definition: game_object.hpp:83
Base class for all dynamic/moving game objects.
Definition: moving_object.hpp:35
Definition: skydive.hpp:22
A helper structure to list all the type_indexes of the classes in the type hierarchy of a given class...
Definition: game_object.hpp:57
virtual bool is_snipable() const override
Can enemy be sniped by sliding or swimboosting Tux? Returns false if enemy is spiky or too large...
Definition: skydive.hpp:46
virtual void grab(MovingObject &object, const Vector &pos, Direction dir) override
called each frame when the object has been grabbed.
Definition: skydive.cpp:66
virtual std::vector< Direction > get_allowed_directions() const override
Returns a vector of directions the badguy can be set to.
Definition: skydive.cpp:208
Definition: reader_mapping.hpp:32
This module contains methods controlling the player.
Definition: player.hpp:47
This class collects data about a collision.
Definition: collision_hit.hpp:44
virtual void kill_fall() override
Set the badguy to kill/falling state, which makes him falling of the screen (his sprite is turned ups...
Definition: skydive.cpp:180