[Super-tux-commit] supertux/src player.cpp,1.36,1.37
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-04-16 16:25:04
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6317/src Modified Files: player.cpp Log Message: This patch was send to the mailing list by Ryan (aka sik0fewl). « I've made it so that sliding on ice works again (after the changes to the input handling functions--looks much nicer now, btw). I also changed supertux.stgt to make snow5.png ice. You can try out sliding around on ice in the second level. I wasn't really sure what would be a good sliding rate so people should try fiddling with different values. Right now the accel/decel rate is the direct inverse of the velocity.. this inverse can be increased or decreased. Also, the smalltux animation doesn't "slide", he walks to a stop.. haven't really looked into where to fix this, but I'm sure others could find it and fix it before I could. » Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- player.cpp 13 Apr 2004 18:17:26 -0000 1.36 +++ player.cpp 16 Apr 2004 16:24:54 -0000 1.37 @@ -379,7 +379,20 @@ ax = WALK_ACCELERATION_X * -1.5; } } - + + // if we're on ice slow down acceleration or deceleration + if (isice(base.x, base.y + base.height)) + { + /* the acceleration/deceleration rate on ice is inversely proportional to + * the current velocity. + */ + + // increasing 1 will increase acceleration/deceleration rate + // decreasing 1 will decrease acceleration/deceleration rate + // must stay above zero, though + if (ax != 0) ax *= 1 / fabs(vx); + } + physic.set_velocity(vx, vy); physic.set_acceleration(ax, ay); } |