[Super-tux-commit] supertux/src player.cpp,1.186,1.187
Brought to you by:
wkendrick
From: Marek M. <wa...@us...> - 2004-10-08 23:16:21
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4680/src Modified Files: player.cpp Log Message: found some values for tux' flapping speed that feel okay when running (still a little too fast, maybe). Problem is, it's pure coincidence that they fit, since they don't depend on any other speed setting. However, this formula might serve as a basis on which the optimum flapping speed could be calculated. Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.186 retrieving revision 1.187 diff -u -d -r1.186 -r1.187 --- player.cpp 8 Oct 2004 15:56:19 -0000 1.186 +++ player.cpp 8 Oct 2004 23:16:06 -0000 1.187 @@ -593,18 +593,20 @@ jumping = true; flapping = true; float iv = physic.get_velocity_x(); //flapping speed depends on initial velocity - float fv = 1.2; //fixed velocity that is reached when flapping is done + //float fv = 1.2; //fixed velocity that is reached when flapping is done float cv = 0; //current velocity - if (iv < 0) {fv *= (-1);} //make fv negative or positive depending on direction of iv + //if (iv < 0) {fv *= (-1);} //make fv negative or positive depending on direction of iv if (flapping_timer.get_gone() <= TUX_FLAPPING_TIME) { - //TODO: Tux currently slows down too fast; fix that. + //TODO: Values okay when running, but that's pure coincidence; they don't depend on iv anymore. if (iv == 0) {cv = 0;} - else {cv = (iv-((iv-fv)*(float)flapping_timer.get_gone()/TUX_FLAPPING_TIME));} + //else {cv = (iv-((iv-fv)*(float)flapping_timer.get_gone()/TUX_FLAPPING_TIME));} + else {cv = (sqrt(1000-(float)flapping_timer.get_gone()))/10;} //Handle change of direction while flapping if (((dir == LEFT) && (cv > 0)) || (dir == RIGHT) && (cv < 0)) {cv *= (-1);} + //std::cout << cv << std::endl; physic.set_velocity_x(cv); - physic.set_velocity_y((float)flapping_timer.get_gone()/700); + physic.set_velocity_y((float)flapping_timer.get_gone()/800); } } |