Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11750/src
Modified Files:
player.cpp
Log Message:
put both Ryan's and my flapping code into player.cpp with mine currently activated.
I'm trying to find a way to slowly decrease Tux' x-velocity when flapping, rather than instantly setting it to walk-speed.
Index: player.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -d -r1.183 -r1.184
--- player.cpp 7 Oct 2004 23:03:07 -0000 1.183
+++ player.cpp 8 Oct 2004 14:28:42 -0000 1.184
@@ -577,7 +577,32 @@
}
}
- // Flapping
+
+ // Flapping, Marek's version
+ if (input.jump == DOWN && can_flap)
+ {
+ if (!flapping_timer.started())
+ {
+ flapping_timer.start(TUX_FLAPPING_TIME);
+ }
+ if (!flapping_timer.check())
+ {
+ 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;
+ if (flapping_timer.get_gone() <= TUX_FLAPPING_TIME)
+ {
+ //TODO: ...here, using get_gone to slow him down at an increasing rate
+ physic.set_velocity_y((float)flapping_timer.get_gone()/700);
+ }
+ }
+
+ /* // Flapping, Ryan's version
if (input.jump == DOWN && can_flap)
{
if (!flapping_timer.started())
@@ -589,8 +614,6 @@
can_flap = false;
falling_from_flap = true;
}
- //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;
if (flapping && flapping_timer.get_gone() <= TUX_FLAPPING_TIME
@@ -599,8 +622,6 @@
float gravity = Sector::current()->gravity;
float xr = (fabsf(physic.get_velocity_x()) / MAX_RUN_XM);
- //physic.set_velocity_y((float)flapping_timer.get_gone()/700);
-
// XXX: magic numbers. should be a percent of gravity
// gravity is (by default) -0.1f
physic.set_acceleration_y(.12 + .01f*xr);
@@ -621,6 +642,7 @@
{
physic.set_acceleration_y(0);
}
+ */
// Hover
//(disabled by default, use cheat code "hover" to toggle on/off)
|