X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fbadguy%2Fwalking_badguy.hpp;h=f5a7eb6279ff01b3d3beb050620b723572baac3e;hb=788a9153f60fb3d25a52fd184387ebbde7636719;hp=98d694fb28e182116999effef50473b427d7dfa7;hpb=dde03feb2d56f02e1515612a0c7e4ee9a4238563;p=supertux.git diff --git a/src/badguy/walking_badguy.hpp b/src/badguy/walking_badguy.hpp index 98d694fb2..f5a7eb627 100644 --- a/src/badguy/walking_badguy.hpp +++ b/src/badguy/walking_badguy.hpp @@ -22,8 +22,10 @@ #include "badguy.hpp" +class Timer; + /** - * Baseclass for a Badguy that just walks around. + * Base class for Badguys that walk on the floor. */ class WalkingBadguy : public BadGuy { @@ -32,19 +34,26 @@ public: WalkingBadguy(const Vector& pos, Direction direction, const std::string& sprite_name, const std::string& walk_left_action, const std::string& walk_right_action, int layer = LAYER_OBJECTS); WalkingBadguy(const lisp::Lisp& reader, const std::string& sprite_name, const std::string& walk_left_action, const std::string& walk_right_action, int layer = LAYER_OBJECTS); - void activate(); + void initialize(); void write(lisp::Writer& writer); void active_update(float elapsed_time); void collision_solid(const CollisionHit& hit); HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit); + void freeze(); + void unfreeze(); + + float get_velocity_y() const; + void set_velocity_y(float vy); protected: - void turn_around(); + void turn_around(); std::string walk_left_action; std::string walk_right_action; float walk_speed; int max_drop_height; /**< Maximum height of drop before we will turn around, or -1 to just drop from any ledge */ + Timer turn_around_timer; + int turn_around_counter; /**< counts number of turns since turn_around_timer was started */ }; #endif