src/badguy/walking_badguy.hpp

Go to the documentation of this file.
00001 //  SuperTux - WalkingBadguy
00002 //  Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
00003 //
00004 //  This program is free software: you can redistribute it and/or modify
00005 //  it under the terms of the GNU General Public License as published by
00006 //  the Free Software Foundation, either version 3 of the License, or
00007 //  (at your option) any later version.
00008 //
00009 //  This program is distributed in the hope that it will be useful,
00010 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //  GNU General Public License for more details.
00013 //
00014 //  You should have received a copy of the GNU General Public License
00015 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 
00017 #ifndef HEADER_SUPERTUX_BADGUY_WALKING_BADGUY_HPP
00018 #define HEADER_SUPERTUX_BADGUY_WALKING_BADGUY_HPP
00019 
00020 #include "badguy/badguy.hpp"
00021 
00022 class Timer;
00023 
00027 class WalkingBadguy : public BadGuy
00028 {
00029 public:
00030   WalkingBadguy(const Vector& pos, 
00031                 const std::string& sprite_name, 
00032                 const std::string& walk_left_action, 
00033                 const std::string& walk_right_action, 
00034                 int layer = LAYER_OBJECTS);
00035   WalkingBadguy(const Vector& pos, Direction direction, 
00036                 const std::string& sprite_name, 
00037                 const std::string& walk_left_action, 
00038                 const std::string& walk_right_action, 
00039                 int layer = LAYER_OBJECTS);
00040   WalkingBadguy(const Reader& reader, 
00041                 const std::string& sprite_name, 
00042                 const std::string& walk_left_action, 
00043                 const std::string& walk_right_action, 
00044                 int layer = LAYER_OBJECTS);
00045 
00046   void initialize();
00047   void active_update(float elapsed_time);
00048   void active_update(float elapsed_time, float target_velocity);
00049   void collision_solid(const CollisionHit& hit);
00050   HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
00051   void freeze();
00052   void unfreeze();
00053 
00054   float get_velocity_y() const;
00055   void set_velocity_y(float vy);
00056 
00060   void add_velocity(const Vector& velocity);
00061 
00062   float get_walk_speed (void) const
00063   {
00064     return (walk_speed);
00065   }
00066   void  set_walk_speed (float);
00067 
00068 protected:
00069   void turn_around();
00070 
00071 protected:
00072   std::string walk_left_action;
00073   std::string walk_right_action;
00074   float walk_speed;
00075   int max_drop_height; 
00076   Timer turn_around_timer;
00077   int turn_around_counter; 
00078 };
00079 
00080 #endif
00081 
00082 /* EOF */

Generated on Mon Apr 14 03:38:19 2014 for SuperTux by  doxygen 1.5.1