X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject%2Frock.hpp;h=099d7caced33b8dc9c892a055e16dc4c97087e38;hb=4587bd9c8fc5cbb20f1e442de76bc06571ab56ba;hp=9e48d1b24f49bed5591c39d1df887f4e42dcf02b;hpb=fbf5cd9ecbfa34368697837587873d82a098494f;p=supertux.git diff --git a/src/object/rock.hpp b/src/object/rock.hpp index 9e48d1b24..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,15 +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" @@ -28,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