Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28047/src
Modified Files:
player.cpp
Log Message:
when flapping, Tux' x-velocity decreases slowly now
values still need some adjustment, and changing directions while flapping doesn't work yet.
Index: player.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -d -r1.184 -r1.185
--- player.cpp 8 Oct 2004 14:28:42 -0000 1.184
+++ player.cpp 8 Oct 2004 15:33:54 -0000 1.185
@@ -590,14 +590,18 @@
can_flap = false;
falling_from_flap = true;
}
- //TODO: The slowing down of Tux should be handled...
- if (physic.get_velocity_x() > 0) {physic.set_velocity_x(WALK_SPEED);}
- else if (physic.get_velocity_x() < 0) {physic.set_velocity_x(WALK_SPEED * (-1));}
jumping = true;
flapping = true;
+ float iv = physic.get_velocity_x();
+ float fv = 1.2;
+ float cv = 0;
+ if (iv < 0) {fv *= (-1);}
if (flapping_timer.get_gone() <= TUX_FLAPPING_TIME)
{
- //TODO: ...here, using get_gone to slow him down at an increasing rate
+ //FIXME: Changing directions while flapping doesn't work yet
+ if (iv == 0) {cv = 0;}
+ else {cv = (iv-((iv-fv)*(float)flapping_timer.get_gone()/TUX_FLAPPING_TIME));}
+ physic.set_velocity_x(cv);
physic.set_velocity_y((float)flapping_timer.get_gone()/700);
}
}
|