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;
/* Trampoline */
struct TrampolineData
{
- int power;
+ float power;
};
class Trampoline : public GameObject
Physic physic;
private:
- int power;
+ float power;
unsigned int frame;
};
_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);
}
{
(*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);