X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject%2Frock.hpp;h=86a8e0e1bdae8f741021fb627d372beac382ce32;hb=1dfbd27a41341f26775ca4e2b9ca4864f5744a6f;hp=28be0e6c9cae3df40819ada799912ee9878b4168;hpb=5b7f9214cb929399f1a855ef5807018a9447d510;p=supertux.git diff --git a/src/object/rock.hpp b/src/object/rock.hpp index 28be0e6c9..86a8e0e1b 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,26 @@ class Sprite; -class Rock : public MovingObject, public Portable, public Serializable +class Rock : public MovingSprite, public Portable, protected UsesPhysic, public Serializable { public: + Rock(const Vector& pos, std::string spritename); 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