X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject%2Frock.hpp;h=099d7caced33b8dc9c892a055e16dc4c97087e38;hb=4587bd9c8fc5cbb20f1e442de76bc06571ab56ba;hp=28be0e6c9cae3df40819ada799912ee9878b4168;hpb=5b7f9214cb929399f1a855ef5807018a9447d510;p=supertux.git diff --git a/src/object/rock.hpp b/src/object/rock.hpp index 28be0e6c9..099d7cace 100644 --- a/src/object/rock.hpp +++ b/src/object/rock.hpp @@ -1,7 +1,7 @@ // $Id$ -// +// // SuperTux -// Copyright (C) 2005 Matthias Braun +// Copyright (C) 2006 Matthias Braun // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -12,16 +12,15 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __ROCK_H__ #define __ROCK_H__ -#include "moving_object.hpp" +#include "object/moving_sprite.hpp" #include "physic.hpp" #include "lisp/lisp.hpp" #include "portable.hpp" @@ -29,23 +28,25 @@ class Sprite; -class Rock : public MovingObject, public Portable, public Serializable +class Rock : public MovingSprite, public Portable, protected UsesPhysic, public Serializable { public: Rock(const lisp::Lisp& reader); - virtual ~Rock(); + Rock(const lisp::Lisp& reader, std::string spritename); + virtual Rock* clone() const { return new Rock(*this); } + void collision_solid(const CollisionHit& hit); HitResponse collision(GameObject& other, const CollisionHit& hit); void update(float elapsed_time); - void draw(DrawingContext& context); void write(lisp::Writer& writer); - - void grab(MovingObject& object, const Vector& pos); -private: + void grab(MovingObject& object, const Vector& pos, Direction dir); + void ungrab(MovingObject& object, Direction dir); + +protected: + bool on_ground; bool grabbed; - Sprite* sprite; - Physic physic; + Vector last_movement; }; #endif