- trampoline stuff
authorRyan Flegel <rflegel@gmail.com>
Mon, 17 May 2004 01:24:24 +0000 (01:24 +0000)
committerRyan Flegel <rflegel@gmail.com>
Mon, 17 May 2004 01:24:24 +0000 (01:24 +0000)
SVN-Revision: 1225

src/gameobjs.cpp
src/gameobjs.h
src/level.cpp
src/world.cpp

index 04b8a59..3fcf030 100644 (file)
@@ -305,9 +305,9 @@ Trampoline::collision(void *p_c_object, int c_object, CollisionType type)
           frame = 0;
 
         if (squish_amount < 24)
-        {
-          pplayer_c->physic.set_velocity_y(8);
-        }
+          pplayer_c->physic.set_velocity_y(power);
+        else if (pplayer_c->physic.get_velocity_y() < 0)
+          pplayer_c->physic.set_velocity_y(-squish_amount/32);
       }
 
       break;
index 660d2f6..36c508c 100644 (file)
@@ -110,7 +110,7 @@ class FloatingScore : public GameObject
 /* Trampoline */
 struct TrampolineData
 {
-  int power;
+  float power;
 };
 
 class Trampoline : public GameObject
@@ -133,7 +133,7 @@ class Trampoline : public GameObject
   Physic physic;
 
  private:
-  int power;
+  float power;
   unsigned int frame;
 };
 
index 3bd31f5..0a7f7ab 100644 (file)
@@ -416,7 +416,7 @@ Level::load(const std::string& filename)
                       _trampoline_data.type = OBJ_TRAMPOLINE;
                       reader.read_int("x", &_trampoline_data.x);
                       reader.read_int("y", &_trampoline_data.y);
-                      reader.read_int("power", &_trampoline_data.type_specific.power);
+                      reader.read_float("power", &_trampoline_data.type_specific.power);
 
                       trampoline_data.push_back(_trampoline_data);
                     }
index 7db4ed5..00f3812 100644 (file)
@@ -511,7 +511,7 @@ World::collision_handler()
       {
         (*i)->collision(&tux, CO_PLAYER, COLLISION_SQUISH);
       }
-      else
+      else if (tux.previous_base.y <= tux.base.y)
       {
         tux.collision(*i, CO_TRAMPOLINE);
         (*i)->collision(&tux, CO_PLAYER, COLLISION_NORMAL);