* Added a boolean "disable-physics" property to powerups. We can't afford losing...
authorOndřej Hošek <ondra.hosek@gmail.com>
Sun, 6 Nov 2005 18:11:18 +0000 (18:11 +0000)
committerOndřej Hošek <ondra.hosek@gmail.com>
Sun, 6 Nov 2005 18:11:18 +0000 (18:11 +0000)
SVN-Revision: 2948

data/levels/world2/level2.stl
src/object/powerup.cpp
src/object/powerup.hpp

index 6539e06..6f91f86 100644 (file)
       (powerup (x 8000) (y 352)
         (sprite "key-gold")
         (script "get_gold_key();")
+        (disable-physics #t)
       )
       (infoblock (x 2560) (y 320)
         (message (_ "-Oh no!
index 9d3ff93..c9733c6 100644 (file)
@@ -36,6 +36,8 @@ PowerUp::PowerUp(const lisp::Lisp& lisp)
   lisp.get("y", bbox.p1.y);
   lisp.get("sprite", sprite_name);
   lisp.get("script", script);
+  no_physics = false;
+  lisp.get("disable-physics", no_physics);
   bbox.set_size(32, 32);   
   sprite = sprite_manager->create(sprite_name);
   physic.enable_gravity(true);
@@ -89,7 +91,8 @@ PowerUp::collision(GameObject& other, const CollisionHit& hit)
 void
 PowerUp::update(float elapsed_time)
 {
-  movement = physic.get_movement(elapsed_time);
+  if (!no_physics)
+    movement = physic.get_movement(elapsed_time);
 }
 
 void
index 99d522a..7e34464 100644 (file)
@@ -40,6 +40,7 @@ private:
   Sprite* sprite;
   Physic physic;
   std::string script;
+  bool no_physics;
 };
 
 #endif