-modified moving platform class to make use of the new path class.
[supertux.git] / src / object / rock.cpp
index 121fc4c..0600b11 100644 (file)
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //  02111-1307, USA.
-
 #include <config.h>
 
-#include "rock.h"
-#include "sprite/sprite.h"
-#include "sprite/sprite_manager.h"
-#include "lisp/writer.h"
-#include "video/drawing_context.h"
-#include "resources.h"
-#include "object_factory.h"
+#include "rock.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "lisp/writer.hpp"
+#include "video/drawing_context.hpp"
+#include "resources.hpp"
+#include "object_factory.hpp"
 
 Rock::Rock(const lisp::Lisp& reader)
 {
@@ -62,7 +61,7 @@ Rock::draw(DrawingContext& context)
 }
 
 void
-Rock::action(float elapsed_time)
+Rock::update(float elapsed_time)
 {
   if(!grabbed) {
     flags |= FLAG_SOLID;
@@ -78,13 +77,17 @@ Rock::action(float elapsed_time)
 }
 
 HitResponse
-Rock::collision(GameObject& , const CollisionHit& )
+Rock::collision(GameObject& object, const CollisionHit& )
 {
   if(grabbed)
     return FORCE_MOVE;
 
-  physic.set_velocity(0, 0);
-  return CONTINUE;
+  if(object.get_flags() & FLAG_SOLID) {
+      physic.set_velocity(0, 0);
+      return CONTINUE;
+  }
+
+  return FORCE_MOVE;
 }
 
 void
@@ -94,5 +97,5 @@ Rock::grab(MovingObject& , const Vector& pos)
   grabbed = true;
 }
 
-IMPLEMENT_FACTORY(Rock, "rock")
+IMPLEMENT_FACTORY(Rock, "rock");