[Super-tux-commit] supertux/src player.cpp,1.187,1.188 player.h,1.89,1.90
Brought to you by:
wkendrick
From: Marek M. <wa...@us...> - 2004-10-09 18:01:14
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22441/src Modified Files: player.cpp player.h Log Message: further tweaked flapping, finally found a speed setting that seems okay Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.187 retrieving revision 1.188 diff -u -d -r1.187 -r1.188 --- player.cpp 8 Oct 2004 23:16:06 -0000 1.187 +++ player.cpp 9 Oct 2004 18:01:01 -0000 1.188 @@ -168,6 +168,8 @@ enable_hover = false; butt_jump = false; + flapping_velocity = 0; + frame_main = 0; frame_ = 0; @@ -584,6 +586,7 @@ if (!flapping_timer.started()) { flapping_timer.start(TUX_FLAPPING_TIME); + flapping_velocity = physic.get_velocity_x(); } if (!flapping_timer.check()) { @@ -592,21 +595,15 @@ } 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 cv = 0; //current velocity - //if (iv < 0) {fv *= (-1);} //make fv negative or positive depending on direction of iv if (flapping_timer.get_gone() <= TUX_FLAPPING_TIME) { - //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 = (sqrt(1000-(float)flapping_timer.get_gone()))/10;} + float cv; + if (flapping_velocity == 0) {cv = 0;} + else {cv = flapping_velocity*(sqrt(TUX_FLAPPING_TIME-(float)flapping_timer.get_gone()))/sqrt(TUX_FLAPPING_TIME);} //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()/800); + physic.set_velocity_y((float)flapping_timer.get_gone()/850); } } Index: player.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.h,v retrieving revision 1.89 retrieving revision 1.90 diff -u -d -r1.89 -r1.90 --- player.h 7 Oct 2004 17:50:21 -0000 1.89 +++ player.h 9 Oct 2004 18:01:02 -0000 1.90 @@ -157,6 +157,8 @@ bool butt_jump; int frame_; int frame_main; + + float flapping_velocity; base_type previous_base; Timer invincible_timer; |