Experiments in kart drifting and stopping, please test to decide.

Added penalization to drifting, so it reduces engine power and players
stop abusing it (AIs would need the same limit).
Added logic to engange full brakes so the kart can be stopped if there
is no power applied and the speed is low.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3339 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
mbjornstk 2009-04-01 18:02:07 +00:00
parent aca8bb39c7
commit 91c3b49eec

View File

@ -790,6 +790,9 @@ void Kart::updatePhysics (float dt)
// Engine slow down due to terrain (see m_power_reduction is set in
// update() depending on terrain type.
engine_power *= m_power_reduction/stk_config->m_slowdown_factor;
// Lose some traction when skidding, so it is not abused by player
if(m_controls.m_drift)
engine_power *= 0.75f;
m_vehicle->applyEngineForce(engine_power, 2);
m_vehicle->applyEngineForce(engine_power, 3);
// Either all or no brake is set, so test only one to avoid
@ -849,8 +852,16 @@ void Kart::updatePhysics (float dt)
m_vehicle->applyEngineForce(-m_controls.m_accel*engine_power*0.1f, 2);
m_vehicle->applyEngineForce(-m_controls.m_accel*engine_power*0.1f, 3);
#if 1
// If not giving power (forward or reverse gear), and speed is low
// we are "parking" the kart, so in battle mode we can ambush people, eg
if(abs(m_speed) < 5.0f) {
for(int i=0; i<4; i++) m_vehicle->setBrake(100.0f, i);
}
#else
if(!RaceManager::getWorld()->isStartPhase())
resetBrakes();
#endif
}
}
#ifdef ENABLE_JUMP