[Super-tux-commit] supertux/src physic.cpp,1.10,1.11 physic.h,1.12,1.13 player.cpp,1.48,1.49
Brought to you by:
wkendrick
From: Ingo R. <gr...@us...> - 2004-04-20 17:58:51
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17991 Modified Files: physic.cpp physic.h player.cpp Log Message: - stop tux if he ran into a block, no more accelerating while standing infront of a block Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- player.cpp 20 Apr 2004 17:31:11 -0000 1.48 +++ player.cpp 20 Apr 2004 17:58:12 -0000 1.49 @@ -183,17 +183,27 @@ previous_base = base; physic.apply(frame_ratio, base.x, base.y); - if(dying == DYING_NOT) { + if(dying == DYING_NOT) + { + base_type target = base; + collision_swept_object_map(&old_base, &base); + + // Don't accelerate Tux if he is running against a wall + if (target.x != base.x) + { + physic.set_velocity_x(0); + } + // special exception for cases where we're stuck under tiles after // being ducked. In this case we drift out if(!duck && on_ground() && old_base.x == base.x && old_base.y == base.y - && collision_object_map(&base)) { - base.x += frame_ratio * WALK_SPEED * (dir ? 1 : -1); - previous_base = old_base = base; + && collision_object_map(&base)) { + base.x += frame_ratio * WALK_SPEED * (dir ? 1 : -1); + previous_base = old_base = base; } keep_in_bounds(); - } + } if (dying == DYING_NOT) { @@ -273,10 +283,10 @@ if (get_current_music() == HERRING_MUSIC && !invincible_timer.check()) { /* - no, we are no more invincible - or we were not in invincible mode - but are we in hurry ? - */ + no, we are no more invincible + or we were not in invincible mode + but are we in hurry ? + */ // FIXME: Move this to gamesession if (GameSession::current()->time_left.get_left() < TIME_WARNING) @@ -284,7 +294,7 @@ /* yes, we are in hurry stop the herring_song, prepare to play the correct fast level_song ! - */ + */ set_current_music(HURRYUP_MUSIC); } else Index: physic.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/physic.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- physic.h 20 Apr 2004 17:31:11 -0000 1.12 +++ physic.h 20 Apr 2004 17:58:00 -0000 1.13 @@ -51,6 +51,9 @@ */ void set_acceleration(float ax, float ay); + void set_acceleration_x(float ax); + void set_acceleration_y(float ay); + float get_acceleration_x(); float get_acceleration_y(); Index: physic.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/physic.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- physic.cpp 20 Apr 2004 17:31:11 -0000 1.10 +++ physic.cpp 20 Apr 2004 17:58:00 -0000 1.11 @@ -85,6 +85,18 @@ } void +Physic::set_acceleration_x(float nax) +{ + ax = nax; +} + +void +Physic::set_acceleration_y(float nay) +{ + ay = -nay; +} + +void Physic::set_acceleration(float nax, float nay) { ax = nax; |