From: Ryan Flegel Date: Mon, 17 May 2004 01:24:24 +0000 (+0000) Subject: - trampoline stuff X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=cb2a0c1b187b479350287a38c325d6a607691807;p=supertux.git - trampoline stuff SVN-Revision: 1225 --- diff --git a/src/gameobjs.cpp b/src/gameobjs.cpp index 04b8a59ed..3fcf0306d 100644 --- a/src/gameobjs.cpp +++ b/src/gameobjs.cpp @@ -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; diff --git a/src/gameobjs.h b/src/gameobjs.h index 660d2f60d..36c508c5a 100644 --- a/src/gameobjs.h +++ b/src/gameobjs.h @@ -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; }; diff --git a/src/level.cpp b/src/level.cpp index 3bd31f5e9..0a7f7ab5a 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -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); } diff --git a/src/world.cpp b/src/world.cpp index 7db4ed5aa..00f381273 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -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);